Re: populate pulldownbox from query [message #174094 is a reply to message #174083] |
Sat, 21 May 2011 13:05 |
TK
Messages: 6 Registered: May 2011
Karma:
|
Junior Member |
|
|
On 5/21/2011 2:29 AM, Co wrote:
> I do get the right data from the database.
> The listbox gets filled correctly.
>
> It is just that the name which is currently set as partner doesn't
> show in the box.
> I tried to fix that with:
> echo "<option value='$partner'>{$nt['rank']} {$nt['firstname']}
> {$nt['lastname']}</option>";
> Problem is that I cannot do it at first I have to wait until the do
> while loop for filling the listbox
> has run.
Inset this in your while loop:
// Substitue your variable names
$f='';
if($rowAff['c_id']==$row['ch_id']) {$f="selected=\"selected\"";}
echo "<option $f
value=\"{$rowAff['c_id']}\">{$rowAff['church']}</option>\n";}
$f makes the current choice show in the option box. If I understood the
problem correctly.
--
TK ~ aka Terry Kimpling
http://wejuggle2.com/
If you can be legally insane, can you not be illegally insane?
|
|
|