You are here: Re: Help Building Dynamic Checkboxes « PHP « IT news, forums, messages
Re: Help Building Dynamic Checkboxes

Posted by Aaron Greenspan on 08/13/05 19:30

Hi,

There are a couple of problems with your code. The first is that you
have global variables enabled, which makes things easier, but also makes
things less secure. You should definitely disable them in your php.ini
file if possible.

Also, when you put the square brackets after gmev (gmev[]), you turn
$_POST['gmev'] into an array. Yet your code just checks to see if the
$_POST['gmev'] variable has any value at all, which of course, it does.


> if ($gmev) {
> $checked = ' checked="checked"';
> } else {
> $checked = '';
> }

Therefore, when you go to present the form, $checked always has the
string from the first case in the if statement, since you're not
specifying which part of the $gmev array you really care about.

My suggestion to everyone dealing with these form problems, which are a
general pain... Use Lampshade. It's so much easier! You can do this all
in three lines of code: two to set up your choices for the form element,
and one to draw the element itself.

http://www.thinkcomputer.com/software/lampshade

I'd be glad to help you with it if you have any questions.

Best of luck,

Aaron

Aaron Greenspan
President & CEO
Think Computer Corporation

http://www.thinkcomputer.com

 

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

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