Hello,
I've been going crazy over this for a few days now.
I have a 2 page form where in the first part you choose from 36 categories and in the second you answer questions about the categories you chose, all the questions are the same but the categories are different.
I have the following code where I'm passing in a variable that contains the name of the category and loops thru until all the chosen categories are displayed:
<form method=POST action="check.php">
<?php
function Subcat ($varname)
{
?>
<br><strong><?php echo $varname ?></strong>
<br><input type="hidden" name="<?php echo $varname ?>[0]" value="<?php echo $varname ?>">
<br><input type="checkbox" name="<?php echo $varname ?>[1]" value="Yes"><font size="2"><strong><em>Interest</em></strong>
<br><input type="checkbox" name="<?php echo $varname ?>[2]" value="Yes"><font size="2"><strong><em>Skills</em></strong>
<br><input type="checkbox" name="<?php echo $varname ?>[3]" value="Yes"><font size="2"><strong>Employment</strong>
<br>Current Company/Organization: <input type="text" name="<?php echo $varname ?>[4]">
<br>Location: <input type="text" name="<?php echo $varname ?>[5]">
<?php
}
?>
check.php contains the following: (one of the variables passed in is the string "Aging" so I was trying to check if the array worked ok.)
6: <?php
7:
8: foreach ( $Aging as $Item=>$Val)
9: {
10: print "---$Item ==>> $Val<br>\n";
11: }
12:
13: ?>
I get the following errors when trying to display check.php:
Warning: Invalid argument supplied for foreach() in c:\inetpub\wwwroot\ALFO\check.php on line 8
When running the code above for $_POST I get "Aging ===>> Array - so I'm assuming the array is indeed created, I just can't manage to traverse thru it. Any suggestions on what might be wrong?
Thanks a bunch.
Geektb