problems with checkboxes
Posted: Thu Nov 26, 2009 9:35 am
Hi Guys,
I'm having an issue with some checkboxes, which don't seem to be passing the state across to the new file.
the script I have thus far is
file1.html
file2.php
But all I get when I tick the boxes (some or all or none) and click Submit is:
SLAVE 1
not selected (1)not selected (2)not selected (3)not selected (4)
Can anybody see what I am missing please?
I'm having an issue with some checkboxes, which don't seem to be passing the state across to the new file.
the script I have thus far is
file1.html
Code: Select all
<form action="file2.php" method="post">
Slave 1 <INPUT TYPE="checkbox" NAME="slave[]"><br/>
Slave 2 <INPUT TYPE="checkbox" NAME="slave[]"><br/>
Slave 3 <INPUT TYPE="checkbox" NAME="slave[]"><br/>
Slave 4 <INPUT TYPE="checkbox" NAME="slave[]"><br/>
<br/>
<input type="submit" />
</form>
Code: Select all
<?php
If (isset($_POST['Slave[1]']))
{
echo "Slave 1" ;
}
ELSE
{
echo "not selected (1)";
}
//////////////////////////////////
If (isset($_POST['Slave[2]']))
{
echo "Slave 2" ;
}
ELSE
{
echo "not selected (2)";
}
/////////////////////////////////
If (isset($_POST['Slave[3]']))
{
echo "Slave 3" ;
}
ELSE
{
echo "not selected (3)";
}
////////////////////////////////
If (isset($_POST['Slave[4]']))
{
echo "Slave 4" ;
}
ELSE
{
echo "not selected (4)";
}
?>
But all I get when I tick the boxes (some or all or none) and click Submit is:
SLAVE 1
not selected (1)not selected (2)not selected (3)not selected (4)
Can anybody see what I am missing please?