You are here: problem with dynamic populating checkbox « All PHP « IT news, forums, messages
problem with dynamic populating checkbox

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация