Jump to content

drop down box


christophe

Recommended Posts

Hi there,

Right O.K I have this code

[code]

include_once("includes/config.php");

$query="SELECT letter,id,word,description FROM dictionary";

$result = mysql_query ($query);
echo "<select name=word=''">Word</option>";

while($nt=mysql_fetch_array($result)){
echo "<option value=$nt[id]>$nt[word]</option>";

}
echo "</select>";

?>

[/code]

so my question:

how do i make this script so when a user selects an option from the drop down box it pulls information from the description field in my database and displays this information on the same page?



ive been stuck on this for ages now so any help will be much appreciated

Thanks
Alex
Link to comment
Share on other sites

[quote author=christophe link=topic=116568.msg475026#msg475026 date=1164713206]
Hi there,

Right O.K I have this code

[code]

include_once("includes/config.php");

$query="SELECT letter,id,word,description FROM dictionary";

$result = mysql_query ($query);
echo "<select name=word=''">Word</option>";

while($nt=mysql_fetch_array($result)){
echo "<option value=$nt[id]>$nt[word]</option>";

}
echo "</select>";

?>

[/code]

so my question:

how do i make this script so when a user selects an option from the drop down box it pulls information from the description field in my database and displays this information on the same page?



ive been stuck on this for ages now so any help will be much appreciated

Thanks
Alex
[/quote]


You need use AJAX.

http://www.w3schools.com/ajax/default.asp


Link to comment
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.