Hello,
I have a page that has a set of checkboxes that are created dynamically. In other words each of the checkboxes is assigned a name dynamically by appending a number to the string "box". The problem that I'm having is that when the form is submitted I want it to do something in particular depending on what checkbox is selected. I have tried using the following code
but it doesn't seem to be able to detect that the checkbox has been checked. I know the request variable (i.e. box2) exists since I did a
and saw it listed. So my question is how do I get PHP to recognize that the particular box REQUEST variable has been assigned a value? Any and all help is appreciate.
Thanks
I have a page that has a set of checkboxes that are created dynamically. In other words each of the checkboxes is assigned a name dynamically by appending a number to the string "box". The problem that I'm having is that when the form is submitted I want it to do something in particular depending on what checkbox is selected. I have tried using the following code
Code:
if(isset($_REQUEST['HASCUSTOMBRANCHES']))
{
$_SESSION['CustomBranches'] = "";
$HASCUSTOM = 1;
for($i = 1; $i <= $_REQUEST['HASCUSTOMBRANCHES']; $i++)
{
print "inside for loop";
$checkBox = "box$i";
//if($_REQUEST('$checkBox')
if(isset($_REQUEST["$checkbox"]))
{
print "the checkbox $checkBox was checked";
}
}
}
but it doesn't seem to be able to detect that the checkbox has been checked. I know the request variable (i.e. box2) exists since I did a
Code:
print_R($_REQUEST);
Thanks