You are here: Re: Grabbing checkbox values « PHP Programming Language « IT news, forums, messages
Re: Grabbing checkbox values

Posted by Amer Neely on 11/12/06 20:46

Amer Neely wrote:
> I've got a dynamically built form with checkboxes for each element ( a
> list of file names in a directory). I need to grab only those checkboxes
> that are checked, so I can then delete those files.
>
> Does each checkbox name have to be unique? I was hoping to just group
> them under one name, and select from that array.
>
> PHP is not my native language - I'm coming at this from Perl, so bear
> with me, things are a little different in that country.
>
> I've tried:
> foreach ($_REQUEST as $field => $value)
> {
> echo "$field = $value<br>";
> }
> but that just grabs the last entry in the group.
>
> The line in question is:
> <input type="checkbox" name="DeleteThis" value="<?php
> echo("$allfiles[$i]")?>">&nbsp;<?php echo("$allfiles[$i]")?><br>

I've changed the code for the above line so the name now is unique for
each element. That now lets me grab whichever one/s are checked. But,
another problem has arisen.

I also have a JavaScript toggle to 'Select/Unselect All' checkboxes,
which works fine. But the 'checked' status doesn't seem to be getting
passed to the PHP code. So, when I display the items checked, it is
incorrect. Refreshing the page also doesn't seem to correct it. Only
physically clicking the checkboxes seems to work.

--
Amer Neely
w: www.softouch.on.ca/
b: www.softouch.on.ca/blog/
Perl | MySQL programming for all data entry forms.
"We make web sites work!"

 

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

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