Reg. Dynamically populate a checkbox



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++;
}
?>

.



Relevant Pages

  • Re: Display Images from Blob Field
    ... method of using PHP to retrieve an image from a blob field and display ...
    (alt.php)
  • Re: dymanic populating checkboxes
    ... First of all im vry new to PHP, i like to retrieve a value from DB, ... accordingly i like to display the checkbox, ... inside a string. ...
    (comp.lang.php)
  • PHP and mysql seems very slow.
    ... I am testing php and mysql, because our ISP only uses that. ... To retrieve 25 records from a table of 1564 records, and display the ...
    (comp.lang.php)
  • Retrieve and display 3rd party pages
    ... I'm wondering if you can show me an example php page that allows me to ... retrieve and display 3rd party pages. ... when my php script is called as http://site/path/getit.php?file_key ... and display the result back to the browser. ...
    (comp.lang.php)
  • problem with dynamic populating checkbox
    ... First of all im vry new to PHP, i like to retrieve a value from DB, ... accordingly i like to display the checkbox, ...
    (alt.php)