|
Posted by calmsqurill on 08/29/06 07:29
HI,
First of all im vry new to PHP, i like to retrieve a value from DB,
accordingly i like to display the checkbox, either checked or not.
Now im able to retrieve the value from DB, i can show even show the
checkbox, but i cant make it checked????
Can anyone help, plzzzzzzz!!!
the Code i used to display as follows,
#Require the database class
require_once('../dbinfoinc.php');
#Get an array containing the resulting
record
$query = "SELECT * FROM event";
$result = mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
if(($i % 2) == 0) { $c =
'"TableDetail"'; }
else { $c = '"TableDetail2"'; }
$event_id=mysql_result($result,$i,"event_id");
$event_name=mysql_result($result,$i,"event_name");
$event_publish=mysql_result($result,$i,"publish");
// if(($event_publish) == 0) {
$event_publish = 'No'; }
// else { $event_publish = 'YES';
}
$take_action = 'Delete';
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' if($event_publish==1){'CHECKED';}?></td>
<td class='navText'
align='center' class=$c><a
href='delete_event.php?event_id=$event_id'>$take_action</a></td></tr>";
$i++;
}
?>
thks
Navigation:
[Reply to this message]
|