Question. I am buidling a website with php and mysql. I have a question about putting information into a form. I can push data back into a form from mysqk if its a text box or a textarea..... However how to do pre-select a value for a radio button or a drown down box.
<input type=radio SELECTED value=foobar>Foo
is the html to preselect (i think) a value. But how to I do this with php and mysql without a hught IF statement with 6 options?
From
Pizmal
working with forms
Moderator: General Moderators
I ussually do something like this
$cmember = what I want selected and I have all the coices in an array
$cmember = what I want selected and I have all the coices in an array
Code: Select all
foreach($names as $name){
$memberbox .= "<option value='$name'";
if($name==$cmember){$memberbox.= " selected";}
$memberbox .=">$name</option>\n";
}