Re: PHP and HTML form help

From: Date: Sat, 10 May 2003 22:22:55 +0000
Subject: Re: PHP and HTML form help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-147151@lists.php.net to get a copy of this message
Dani Matielo wrote: > I have a problem that I can't figure how to solve. It's simple, I just > couldnt find how to do it. > > Here is the problem: > > <SELECT name=id_status id="id_status"> > <? > $status = lista_status(); > for($i=0; $i<sizeof($status); $i++) { > $statu = $status[$i]; > ?> //Assuming $id_status contains the current setting in the db: $selected = ($statu['id'] == $id_status) ? 'SELECTED' : ''; ////> <option value="<?= $statu['id'] ?>"> <OPTION VALUE="<?= $statu['id']?>" <?=$selected?>> > <?= $statu['nome']?> > </option> > <? } ?> > </select> > > lista_status() is a function that lists all the possible status. I just dont > know how to make the initially selected value the one that comes from the > database.

« previous php.general (#147151) next »