I have this simple code:
<?
if (isset($_POST["phpinfo"])) phpinfo(); else echo "you haven't chosen what to do yet";
?>
<h1>Test page 1</h1>
<form method="post" action="">
<select>
<option>Choose what to do</option>
<option value='phpinfo'>phpinfo();</option></select></form>
The problem is that if I use JavaScript (onChange=”this.form.submit()”) to auto-submit the post data it doesn’t submit but if I use a submit button it does submit to self.
<input type="submit" name='phpinfo' id="phpinfo">
My question is, what do I have to do so I can have an auto-submitting drop down list that submits POST data to self?
Thanks in advance!
Your select needs to be named. The select name is what’s returned to PHP, and its value will be the value of the option selected.