Just_Johnny Posted March 24, 2009 Share Posted March 24, 2009 I think I'm finally starting to get this. <html> <title>php-learn-it.com - php ajax form submit</title> <head> <script type="text/javascript" src="prototype.js"></script> <script> function sendRequest() { new Ajax.Request("test2.php", { method: 'post', postBody: 'make='+ $F('id1'), onComplete: showResponse }); } function showResponse(req){ $('show').innerHTML= req.responseText; } </script> </head> <body> <form id="test" onsubmit="return false;"> <select name="make" id="id1">; <? for($x=0;$x<count($makeArray);$x++){ echo "<option value=\"".$makeArray[$x]."\">".$makeArray[$x]."</option>"; } ?> </select> <select name="year" id="id2">; <option value="1998">1998</option> <option value="1999">1999</option> </select> <input type="submit" value="submit" onClick="sendRequest()"> </form> <div id="show"></div> <br/><br/> </body> </html> I return print_r($_POST) and it looks like this. Array ( [make] => Acura ) My first drop down form returns exactly what I want, but I'm having trouble with getting the second drop down. I reverted the js code back to working with just the first drop down "id1". Link to comment https://forums.phpfreaks.com/topic/150933-prototypejs-returns-only-one-of-my-forms-data/ Share on other sites More sharing options...
Just_Johnny Posted March 24, 2009 Author Share Posted March 24, 2009 Can somebody please just point me in the right direction? Link to comment https://forums.phpfreaks.com/topic/150933-prototypejs-returns-only-one-of-my-forms-data/#findComment-793122 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.