Re: checkboxes in php
| From: | Luis Moreira | Date: | Thu, 10 Jul 2003 13:37:47 +0000 |
| Subject: | Re: checkboxes in php | ||
| References: | 1 2 3 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-20763@lists.php.net to get a copy of this message | ||
Take this for an example :
This script fills part of a form with checkboxes named C1,C2, ect
$cnt=0;
for ($i=1;$i<=$n_alunos;$i++) {
if ($cnt==0) {
print "<tr>";
}
print "<td><input type=\"checkbox\" name=\"C$i\"
value=\"on\">Aluno
$i</td>";
$cnt++;
if ($cnt==$colunas) {
print "</tr>";
$cnt=0;
}
}
This script receives the result from the previous form, and checks wether
checkbox C2 is set or not
if (!empty($_POST['C2'])) {
$b = $_POST['C2'];
}
else {
$b = "vazio";
}
An example ...
----- Original Message -----
From: "Harpreet" <harpreet@crispincorp.com>
To: <php-windows@lists.php.net>
Sent: Thursday, July 10, 2003 2:12 PM
Subject: [PHP-WIN] checkboxes in php
> I have 4 checkboxes in a form. I can select any number of boxes.When i go
to
> the results page it gives me errors for boxes i dont select
> Notice: Undefined index: toall in e:\INetPub... on line 27
>
> Please help
> Regards,
> Harpreet
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>