views:

31

answers:

3

Would like to post the value of a dynamic selection menu when the OnChange event is called. My code is currently this:

<form action="test4.php" method="POST" name="itemform">
<select name="input_name" id="input_name" onChange="this.form.submit();">
<?php
    while($row = mysql_fetch_array($result))
        echo "<option value='".$row['item_id']."'>" . $row['itemname'] . "</option>";
?>
</form>

The option values are populated by a query defined above and that works like a charm. The problem I am facing is for some reason the form is not grabbing and POSTing the value selected in the menu box when the OnChange event is raised. Any Ideas?

A: 

Close your <select> tag. ;D

GigaWatt
Good point. Needed to do this thanks! But still not the problem.
Parker
A: 

Try closing your <select> element - that could be it.

Repox
Good point. Needed to do this thanks! But still not the problem.
Parker
+1  A: 

<form action="test4.php" method="POST" name="itemform">

My page test4.php uses this line to retrieve the value: echo ($_GET["input_name"]);

You're mixing up $_GET and $_POST, you need to use the one that corresponds to your form's method.

jnpcl
Thank you!!!!!!
Parker