Just_Johnny Posted March 24, 2009 Share Posted March 24, 2009 I'm using this example here. http://www.php-learn-it.com/tutorials/starting_with_php_and_ajax.html This is where I run into my problem. <?php include("connect_database.php"); <html> <head> <script type="text/javascript" src="prototype.js"></script> <script> function sendRequest() { new Ajax.Request("test.php", { method: 'post', postBody: 'name='+ $F('name'), onComplete: showResponse }); } function showResponse(req){ $('show').innerHTML= req.responseText; } </script> </head> <body> <form id="test" onsubmit="return false;"> <select name="name" id="name" > //everything goes wrong here $query = mysql_query("SELECT * FROM cars"); while($rows=mysql_fetch_array($query)){ $make = $rows['make']; echo"<option value='".$make."'>".$make."</option>"; //end everything goes wrong </select> <input type="submit" value="submit" onClick="sendRequest()"> </form> <div id="show"></div> </body> </html> Quote Link to comment Share on other sites More sharing options...
Just_Johnny Posted March 24, 2009 Author Share Posted March 24, 2009 I meant "Why doesn't this work with Prototype.js" In the code I note where everything goes wrong. Quote Link to comment Share on other sites More sharing options...
corbin Posted March 24, 2009 Share Posted March 24, 2009 Your PHP syntax is entirely wrong x.x. Quote Link to comment Share on other sites More sharing options...
Just_Johnny Posted March 24, 2009 Author Share Posted March 24, 2009 If I take that block of php code and past it into another page it works fine. 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.