I apologize for not making it clear enough. I will try again.
For each row in the database corresponding to someones username. It outputs the image name in that row, the image ID (the value of the checkbox) and one checkbox named "select[]".
If the user has uploaded only one image, then there is only one checkbox named "select[]".
If they have uploaded 2 images there are 2 checkboxes named "select[]" and so on.
I purposely put the image ID above each checkbox so I know what the value should be.
In my case and what I am testing, I have 3 images, with ID's 27, 20, and 24.
Here is my script that acts after I submit the data.
<?
session_start();
$username = $_SESSION['username'];
if ($_SESSION['logged']!==true) {
header('location:loginfailed.php');
}
else {
echo '<pre>'.print_r($_POST,true).'</pre>';
$buttonName = $_POST['submit'];
$imageID = $_POST['select'];
$count = count($imageID);
if ($count != 0)
{
if($buttonName == "Delete Selected Photos")
{
echo '<pre>'.print_r($_POST,true).'</pre>';
}
}
if($buttonName == "Move Selected Photos")
{
}
if($buttonName == "Give me the code!")
{
}
}
}
?>
Even though I check all 3 boxes, the script gives me this.
Array
(
[submit] => Delete Selected Photos
[url] => http://www.photocooler.com/photos/brendan_forum.jpg
[code=html] =>
[img] => [IMG]http://www.photocooler.com/photos/brendan_forum.jpg[/IMG]
[select] => Array
(
[$imageID] => 27
)
)
the Image ID 27 is corresponding to the first checkbox. If I only check the last 2 checkboxes and not the first, I get this message.
Array
(
[submit] => Delete Selected Photos
[url] => http://www.photocooler.com/photos/brendan_forum.jpg
[code=html] =>
[img] => [IMG]http://www.photocooler.com/photos/brendan_forum.jpg[/IMG]
)
So pretty much there is no values in the array unless the first checkbox is selected. And when the first checkbox is selected, I somehow only receive that value although I checked all 3.
I hope this helps, cause this problem bothered me from the start of my project and I put it aside until I really needed it. Thanks again guys.