php slelect tag
Posted: Mon Nov 27, 2006 7:15 am
feyd | Please use
Any help will be much appreciated
Thanks
Alex
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi there,
i have a mysql database table called dictionary.
the fields in this table are letter, word and description
what i need is when a user selects for example Alex (in the field "word") the text in the description field is displayed?
This code displays a select form which gets all the "A" values from the field "letter" in my databaseCode: Select all
$sql = 'SELECT word FROM dictionary WHERE letter="A"';
$res = mysql_query($sql) or die(mysql_error());
while ($rec = mysql_fetch_assoc($res)) $word[] = $rec;
echo '<SELECT name="dropdown">';
foreach ($word as $c)
echo "<OPTION>{$c['word']}</OPTION>\n";
echo '</SELECT>';Thanks
Alex
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]