View Full Version : How to get the value/text on a list?

01-24-2006, 07:52 AM
Hi, I am currently working on a combo list for my work. I have a file written in PHP. I have a number of root categories in my database. Each root category has several subcategories. I use "parant_id" to link them together. I want to make a combo list so that if I choose one root category, its subcategories will show up as a another list. I have already added those root categories to my first list thru mysql query. My question is, how to get the value/name of the category I click on so that I can use it to my second list to pull out the subcategories of the selected root category? The following is my code for the first list. Your help will be appreciated.:thumbsup:

<select name="catID" id="catID">
<option value="0">(All)</option>
$query="select name, id from categories where parent_id=0 and status<>0 order by name";
if ( !($result = mysql_query($query)) ) {
echo "There's been a problem reading the database";
while ($rs = mysql_fetch_assoc($result))
$text = mysql_result($result,$line,"name")
<option value=<?=$line?>><?=$text?></option>

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum