Jump to content

Help with a form


hosker

Recommended Posts

I have a form that I have data being pulled from a MySQL database and it is being put in a drop down list. Once the user selects something on the list, I would like specific data to be pulled from the database and displayed on the page without refreshing it. How would I go about doing that?

 

Below is my code:

 

<?php	$query2="SELECT tournament,id FROM 2011_Tournament";
								$result2=mysql_query($query2);
								echo "<select name=2011_Tournament value='tournament'>Tournament</option>";
								while($tournament=mysql_fetch_array($result2)){
								echo "<option value='$tournament[tournament]'>$tournament[tournament]</option>";
								}
								echo "</select>";?>

Link to comment
https://forums.phpfreaks.com/topic/248114-help-with-a-form/
Share on other sites

with jquery you will want to use the .change event handler

 

http://api.jquery.com/change/

 

with this you can detect when a user changes to a different option in your select tag.. when they do, you can trigger an ajax function to handle the change and make it do whatever you want..

Link to comment
https://forums.phpfreaks.com/topic/248114-help-with-a-form/#findComment-1274106
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.