Re: Reg. Dynamically populate a checkbox
- From: mootmail-googlegroups@xxxxxxxxx
- Date: 29 Aug 2006 05:11:50 -0700
Mumia W. wrote:
Within an echo statement, <? php-code ?> does not work. Just
output a variable's value:
$event_publish_checked = ($event_publish == 1 ? 'CHECKED' : '');
echo "<tr>
<td Class='navText' align='center' class=$c>$event_id</td>
<td class='navText' class=$c>$event_name</td>
<td class='navText' align='center' class=$c><INPUT TYPE=CHECKBOX
NAME='publish' VALUE=1 $event_publish_checked </td>
<td class='navText' align='center' class=$c><a
href='delete_event.php?event_id=$event_id'>$take_action</a></td></tr>";
Alternatively, instead of setting a variable, you can just return the
result of the ternary operator as follows:
<?=($event_publish == 1 ? 'CHECKED' : '')?>
Note the '=' rather than 'echo'.
.
- Follow-Ups:
- Re: Reg. Dynamically populate a checkbox
- From: Dennis de Wit
- Re: Reg. Dynamically populate a checkbox
- References:
- Reg. Dynamically populate a checkbox
- From: calms
- Re: Reg. Dynamically populate a checkbox
- From: Mumia W.
- Re: Reg. Dynamically populate a checkbox
- From: calms
- Re: Reg. Dynamically populate a checkbox
- From: Mumia W.
- Reg. Dynamically populate a checkbox
- Prev by Date: Re: Reg. Dynamically populate a checkbox
- Next by Date: Re: Reg. Dynamically populate a checkbox
- Previous by thread: Re: Reg. Dynamically populate a checkbox
- Next by thread: Re: Reg. Dynamically populate a checkbox
- Index(es):