|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-07-13 06:31 UTC] stormlord at the dot net dot nz
<?
if(!$submit)
{
echo"<form method='POST'>\n";
for($i=0;$i<10;$i++)
{
echo"<input type=checkbox name=\"todel[$i]\" value=\"pjd$i\"><br>\n";
}
echo"<input type=submit name=submit value=submit><br>\n";
echo"</form>\n";
}
else
{
for($i=0;$i<count($todel);$i++)
echo"$i - todel = ".$todel[$i]."<br>";
}
?>
Ok.. now try selecting 2,3,4 in the check box and submit and see if it gives you
the correct values.. its just not working correctly!!! :LLLLL Help!! :)
I've installed PHP4 the way the www.linuxguruz.org site have listed in their
tutorial for PHP + MYSQL + SSL :)
Cheers
Paul.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 18 17:00:02 2025 UTC |
This is a logical error in the program, not a bug. When you loop over your values with the line: for($i=0;$i<count($todel);$i++) you are only running the loop as many times as you have elements in your array. If 2,3,4 are selected, then the count of $todel is 3... so the 4th element will never be reached. Try changing the contents of your else statement to: foreach ($todel as $key => $value) echo "$key - todel = ".$todel[$key].'<br>';