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" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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
>


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

Reply via email to