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
https://forums.phpfreaks.com/topic/28723-drop-down-box/
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
https://forums.phpfreaks.com/topic/28723-drop-down-box/#findComment-131570
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.