Jump to content


Photo

Selecting MySQL variable value, that depends to other value


  • Please log in to reply
1 reply to this topic

#1 Erica McLane

Erica McLane
  • Members
  • Pip
  • Newbie
  • 2 posts

Posted 27 May 2003 - 12:34 PM

How to do this? I have a table, simmilar to this:

Tablename Test.

ID | Title | Text
1 | One | Test1
2 | Two | Test2
3 | Three | Test3
4 | Four | Test4
5 | Five | Test5

I filled one drop-down listbox with the values in Title. Now I need this - the script should display the \'Text\' value, depending on the selected \'Title\' in the SAME PAGE, when the user selects the \'Title\" in the listbox. Is there a way to do this?
Thanks in advance!

Example: There is a listbox and the user selects \'Two\'. Now the script should display \"Test2\".

#2 wompus

wompus
  • Members
  • Pip
  • Newbie
  • 8 posts
  • LocationNY

Posted 27 May 2003 - 07:35 PM

This would be your drop-down
<input name="something">

This would be your php
[php:1:9d98bc23a5]
$query = \"SELECT * FROM tablename WHERE Title = $something\";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
echo($row[\'Text\']);
}


?>[/php:1:9d98bc23a5][/code]
Free the West Memphis 3 http://wm3.org




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users