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> Link to comment https://forums.phpfreaks.com/topic/150826-solved-why-wont-this-work-with-protype/ 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. Link to comment https://forums.phpfreaks.com/topic/150826-solved-why-wont-this-work-with-protype/#findComment-792348 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. Link to comment https://forums.phpfreaks.com/topic/150826-solved-why-wont-this-work-with-protype/#findComment-792359 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. Link to comment https://forums.phpfreaks.com/topic/150826-solved-why-wont-this-work-with-protype/#findComment-792367 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.