Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.