...

View Full Version : why I cant post or get the value of the select box that i choose when click button



che_anj
11-14-2007, 02:01 PM
why I cant post or get the value of the select box that i choose when click button.

Heres my code.



<form name="adfdf" method="post">
<select name="clientss">
<?
while($crow=mysql_fetch_array($qresults)){
if($_GET['clientss']==$crow[employer_name]- $crow[employer_id])
echo "<option value=$crow[employer_name]- $crow[employer_id] selected>$crow[employer_name]</option>";
else
echo "<option value=$crow[employer_name]- $crow[employer_id]>$crow[employer_name]</option>";
}
?>
</select>

<tr><td colspan="2"><input type="submit" name="go" value="Show Report"></td></tr>
</form>

if(isset($_POST['go'])) {
$clientss=$_POST['clientss'];

echo $clientss ----------- I wish to get the value of the select box when clicking the submit button
}

thanksss

Fumigator
11-14-2007, 04:33 PM
Maybe you need a refresher on how PHP deals with forms?

http://www.php.net/manual/en/tutorial.forms.php

rpgfan3233
11-14-2007, 06:39 PM
I believe your problem is that the form needs an action set. That is, you aren't telling it where to post the data to. Also, you are checking for a GET when you are actually POSTing.

Inigoesdr
11-14-2007, 07:39 PM
While you should always set an action, if you don't the form posts to its own page.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum