Update page and select options
Hi all
I'm using a datassist update page to edit records in my database table.
I have a boolean field "contract_signed" which I want to be able to edit using a select drop down and options.
I have figured out how to dispay "yes" and "no" in the options based on the boolean field, and can set the second option (i.e. if field in database is set to 1/yes, that option is selected and the second option is set to 0/no and vice versa) and can change a yes to a no, but can't figure out what I'm doing wrong in the php to be able to change no to yes. Can anyone shed any light for me? My current code is
<select name="contract_signed" id="contract_signed">
<?php
do {
?>
<option value="<?php echo $row_WADAprop_address['contract_signed']?>">
<?php
if ($row_WADAprop_address['contract_signed']==1)
echo "Yes";
else echo "No";
?>
</option>
<?php
} while ($row_WADAprop_address = mysql_fetch_assoc($WADAprop_address));
$rows = mysql_num_rows($WADAprop_address);
if($rows > 0) {
mysql_data_seek($WADAprop_address, 0);
$row_WADAprop_address = mysql_fetch_assoc($WADAprop_address);
}
?>
<option value="<?php if($row_WADAprop_address['contract_signed']==1)
echo "No";
else echo "Yes";
?>">
<?php if($row_WADAprop_address['contract_signed']==1) echo "No"; else echo "Yes";?>
</option>
</select>
Thanks
Phil