I have dynamically created a input field:
<input name="firstname" type="text" id="firstname" value="<?=$row['firstname']?>" size="40">
no probs here
a radio button
<? echo '<input type="radio" name="involved_commitee" value="11 to 25"';
if ($row['involved_paid'] == "11 to 25") {echo 'checked';} echo '>'; ?>
and a list menu
<select name="title" size="1" id="title">
<option selected>not selected</option>
<option>Mr.</option>
<option>Mrs.</option>
<option>Miss</option>
<option>Ms.</option>
</select>
I was wondering how can I have a grouped radio button 'selected' by default and have the list menu echo a prepopulated value? i.e if Mr was chosen in a session then it shows 'Mr' in another session when the user logs in again.
ive already made a start:
include("include/session.php");
$_SESSION['formdata1']='';
$username = $_SESSION['username'];
include("connect.php");
$sql = "SELECT * FROM qualityuser WHERE username = '".$username."'";
$result = mysql_query($sql);
// if we have rows, fetch them & prepopulate the form
if(mysql_num_rows($result) > 0) {
$row = mysql_fetch_array($result);
} else {
$row = array(title=>'', 'firstname'=>'','secondname'=>'','organisation'=>'','telephone'=>'','address1'=>'','address2'=>'','town'=>''
,'postcode'=>''
}
?>
many thanks in advance