[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-general
Subject:    [PHP] R: [PHP] multiple checkbox help
From:       "Alessandro Vitale" <avitale () tiscali ! com>
Date:       2004-05-31 15:08:19
Message-ID: GMEMJFGPOBMNNAFALACFCEAICJAA.avitale () tiscali ! com
[Download RAW message or body]

I usually use this approach:

<INPUT NAME="myName[1]" VALUE="CHECKED" TYPE="CHECKBOX">
.
.
<INPUT NAME="myName[N]" VALUE="CHECKED" TYPE="CHECKBOX">

---------------

foreach($_REQUEST['myName'] as $id => $value)
{
   if($value == "CHECKED")
     array_push($idArray, $id);
}

if something is not clear, let me know

cheers,

A.


-----Messaggio originale-----
Da: Bob Lockie [mailto:bjlockie@lockie.ca]
Inviato: lunedi 31 maggio 2004 16.51
A: php-general Mailing List
Oggetto: [PHP] multiple checkbox help


I tried this HTML:
<input name="deleteID" value="1" type="checkbox">
<input name="deleteID" value="2" type="checkbox">

$_REQUEST['deleteID'] === the last box checked.
so I did a google search and changed my HTML to:

<input name="deleteID[]" value="1" type="checkbox">
<input name="deleteID[]" value="2" type="checkbox">

Now the code:
for ($i = 0; $i < count($_REQUEST['deleteID']); $i++){
     echo "deleting '" . $value . "'";
}
has the right count but how do I get the values out?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic