...

View Full Version : How to pass the value of the input box to other page when click the button



che_anj
08-21-2007, 04:37 PM
Hello anybody could give me idea how to pass the value of input box to other page when clicking the button..

I have a Page that will search according to what category you choose, and the query code execute to other page...

below is my code...



$searchcategory=array("Client","Jobs","Candidates");
$searchval=array("employer_id","vacancy_id","candidate_id");
<form name="quicksearch" method="post">
<tr><td>Keywords</td>
<td><input type="text" name="qsearch" class="inputbox"></td>
</tr>
<tr>
<td >Category</td>
<td>
<select name="find" class="small">';
$index=0;
foreach($searchcategory as $sc)
{
if($searchval[$index]==$find)
echo '<option value="'.$searchval[$index].'" selected>'.$sc.'</option>';
else
echo '<option value="'.$searchval[$index].'">'.$sc.'</option>';
$index++;

}
echo '</select></td>
</tr>

<tr><td>
<input type="submit" name="search" value="Search">
</td>
</tr>
</form>


when clicking the search button the result must display to other page

the filename of the said page is client_list.php but since all pages are under the menu.php, therefore the url looks like this www.mysite.com/menu.php?click=client_list.php&menu=1

tnx.. hope u get it..

Inigoesdr
08-21-2007, 04:44 PM
You need to specify the next page in action="page.php" inside of the <form> tag.

che_anj
08-21-2007, 04:57 PM
I dont think it work because the said page was being include in the menu.php where the form for search is located...

the url must look like below..
http://www.mysite.com/menu.php?page.php&menu=1

if i will simply put the action="page.php"

it look like this
http://www.mysite.com/page.php which is not what i mean because the page.php is being called in the menu.php like this require $_GET['click'];

rafiki
08-21-2007, 05:19 PM
you need to send it to menu.php then form data will be attached to menu.php like so
www.mysite.com/page.php?menu=1&something=something

Inigoesdr
08-21-2007, 05:29 PM
I dont think it work because the said page was being include in the menu.php where the form for search is located...

the url must look like below..
http://www.mysite.com/menu.php?page.php&menu=1

if i will simply put the action="page.php"

it look like this
http://www.mysite.com/page.php which is not what i mean because the page.php is being called in the menu.php like this require $_GET['click'];

If you want to send the variables in the URL and use $_GET to retrieve them then you need to change your form method to: method="get".

rafiki
08-21-2007, 05:31 PM
If you want to send the variables in the URL and use $_GET to retrieve them then you need to change your form method to: method="get".

didnt catch that sorry :(



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum