suttercain Posted December 5, 2007 Share Posted December 5, 2007 Hi guys, I have two select menus using javascript and the first one is populated via a mysql query. The idea is simple, select items from the left menu and add them to the right menu. I then want to inser the information from the right select menu into the database. The problem I am having is that the information that I am adding to the right select menu (or even the left menu for this matter) is not being sent to the $_POST variable. <body> <?php if (isset($_POST['submit'])) { echo $_POST['sel2']; print_r($_POST); } $sql = mysql_query("SELECT * FROM characters ORDER BY name"); ?> <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post"> <table border="0"> <tr> <td> <select name="sel1" size="10" multiple="multiple"> <?php while ($row = mysql_fetch_array($sql)) { echo "<option value='".$row['character_id']."'>".$row['name']. " - ".$row['alter_ego']. "</option>"; } ?> </select> </td> <td align="center" valign="middle"> <input type="button" value="-->" onclick="moveOptions(this.form.sel1, this.form.sel2);" /><br /> <input type="button" value="<--" onclick="moveOptions(this.form.sel2, this.form.sel1);" /> </td> <td> <select name="sel2" size="10" multiple="multiple"> </select> </td> </tr> </table> <input type="submit" name="submit"> </form> <?php ?> </body> I can rationalize why the content from the second select menu, sel2, is not being passed, because there are no values. But shouldn't the first select menu be passed? When I submit the form and print_r($_POST) I get: Array ( [submit] => Submit Query ) Any help would be appreciated.. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.