PHP Developers Network
http://forums.devnetwork.net/

problem with checkboxes in javascript and PHP
http://forums.devnetwork.net/viewtopic.php?f=1&t=19639
Page 1 of 1

Author:  mahmood [ Fri Mar 19, 2004 6:23 pm ]
Post subject:  problem with checkboxes in javascript and PHP

Summary: when i create a series of checkboxes using php, I cannot check if there is at least one checked or not.

and full story: in a script like bellow:
<?
echo "<form name=myform method=post action=test2.php>";
for ($i=0; $i<10; $i++)
{
echo "<input type=checkbox name=mycheckbox[] value=$i><br>";
}
echo "<input type=button onclick='myfunction()'>";
echo "</form>";
?>
if I dont' put [] in front of name attribute i wont be able to send values to the other page (test2.php). and if i put square brackets i cannot find the length of check boxes in my javascript function.

so how do I check if there is at least one checkbox is checked before submitting the form?

Author:  TheBentinel.com [ Fri Mar 19, 2004 8:37 pm ]
Post subject:  Re: problem with checkboxes in javascript and PHP


Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/