Try this
<?
$i = 0;
echo '<form>';
echo '<input type="checkbox" name="temp['.$i++.']" value="3124">';
echo '<input type="checkbox" name="temp['.$i++.']" value="6345">';
echo '<input type="checkbox" name="temp['.$i++.']" value="456243">';
echo '<input type="checkbox" name="temp['.$i++.']" value="45">';
echo '<input type="checkbox" name="temp['.$i++.']" value="6756">';
echo '<input type="checkbox" name="temp['.$i++.']" value="4567">';
echo '<input type="submit" name="submit" value="test">';
echo '</form>';
//Then in PHP whether the box is checked or not your indexes are
correct.
print_r($temp);
?>
Charles Killmer
Netgain Technology
-----Original Message-----
From: Luis Moreira [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 10, 2003 8:38 AM
To: Harpreet
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] checkboxes in php
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
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php