Posted by Ian Davies on 05/27/06 23:32
Hello
I am retreiving records into a table (part of the code below)
<td width="20%" class="BodyText"><span class="style38"><?php echo
$commindex; ?></span></td>
<td width="10%" class="BodyText"><span class="style38"><?php echo
$username; ?></span></td>
<td width="45%" class="BodyText"><span class="style38"><?php echo
$comment; ?></span></td>
<td width="10%" class="BodyText"><span class="greenbody">
<input name="checkbox2" type="checkbox" value="<?php echo <td
width="20%" class="BodyText"><span class="style38"><?php echo $commindex;
?></span></td>
<td width="10%" class="BodyText"><span class="style38"><?php echo
$username; ?></span></td>
<td width="45%" class="BodyText"><span class="style38"><?php echo
$comment; ?></span></td>
<td width="10%" class="BodyText"><span class="greenbody">
<input name="checkbox2" type="checkbox" value="<?php echo
$available; ?>" MYFUNCTIONHERE>
</span></td>; ?>">
</span></td>
The last cell contains a check box, its value is set to $available. which is
a value of 1 or 0.
Trouble is I want the check box to be ticked if the value is 1 and unticked
if the value is 0
I thought of using a function such as
function checked($avail) {
if ($avail = $available) {
return 'checked';
}
}
after the value part of the code (where I have written MYFUNCTIONHERE)
which would put the work 'checked' in the appropriate place
but my inexperience means I cant get the syntax correct
can anyone help
Ian
Navigation:
[Reply to this message]
|