RE: [PHP] Simple question I guess.
| From: | John Holmes | Date: | Mon, 22 Jul 2002 23:17:17 +0000 |
| Subject: | RE: [PHP] Simple question I guess. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-108955@lists.php.net to get a copy of this message | ||
> I have a site with all my movies and stuff stored in a database. And I
> have
> made a admin page where I can add, delete and update records. When I
add
> new
> records, I have made a listbox for the category (ex. action, comedy
etc.)
> so
> I dont have to write it every time I add a new record. But when I push
the
> update button and the data thats stored in the database is printed its
> printed just in a textarea. I know its possible to list the data in a
> listbox, but how do I get the right category selected for the movie I
> choose?
<select name="whatever">
<option value="1" <?if($something==1) { echo "selected"; }
?>>One</option>
<option value="2" <?if($something==2) { echo "selected"; }
?>>Two</option>
etc...
</select>
Put it into a function and the possible values into an array to make it
easier...
---John Holmes...