On Monday 07 April 2003 15:48, Jason End wrote: > Not exactly. My application is a software catalog, > where an admin can insert new software through a form, > and later on, edit it through a similar form. What I > need is that the dropdown menus in the editing form, > reflect values set for the piece of software. > So my categories table can look something like this: > id descr > 1 Operating Systems > 2 Graphics Design > 3 Word Processors > > > And I populate the dropdown list with: > <tr><td>Category:</td> > <td><select name="category"> > <? > $query = "SELECT descr from categorias"; > $result = mysql_query($query, $link); > if(mysql_num_rows($result)) { > > while($row = mysql_fetch_row($result)) > { > print("<option > value=\"$row[0]\">$row[0]</option>"); > } > } else { > print("<option value=\"\">No categories > available</option>"); > } > ?> > </select><br></td> > </tr> > > > What I need is that the value that the dropdown menu > shows, is the actual category set for that software. > The admin can then change it, but the initial value > needs to be the correct one. if ($row[0] == 'some_category') { print("<option value=\"$row[0]\" SELECTED>$row[0]</option>"); } else { print("<option value=\"$row[0]\">$row[0]</option>"); } -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db ------------------------------------------ /* Truth is the most valuable thing we have -- so let us economize it. -- Mark Twain */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php