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

Posted by Dennis de Wit on 08/29/06 08:53

calmsqurill@gmail.com wrote:
> 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!!!
>
>
> [cut]

Hi

Check the output of your code. As you can see it places
if($event_publish==1){'CHECKED';}?> straight into your code. This is
because it is misplaced.


Solution:
Stop your string after 'publish'. Then start a new line with the if
statement, remove the ?>, and start a new string again:

<td class='navText'
align='center' class=$c><input type='checkbox'
name='publish' ";

if($event_publish==1){'CHECKED';}

echo "</td>... etc.

Besides, CHECKED should be checked="checked" to comply with new xhtml
rules (Safari on Mac relies on this :-s)

Dennis

 

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

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