Hello.
(NOTE: this code is 'paraphrased'; register globals is 'off')
I have a form that I'm trying to create an associative array from with these 'input' statements (2 of several shown below):
<input type="checkbox" name=appln['retail'] value= "retail" <?php print $checkd1; ?>>Retail<br>
<input type="checkbox" name=appln['commercial'] value= "commercial" <?php print $checkd2; ?>>Commercial<br>
The form is using the var $form_action which is:
$form_action = "{$_SERVER['PHP_SELF']}";
if (isset($POST['submit'])) {$submit = $POST['submit'];}
(NOTE: this is used to avoid an 'undefined var' error)
Then, I looked to see what was stored in $appln array via:
if ($submit) {...
foreach ($_POST['appln'] as $appln_key => $appln_value)
{
$appln_array['$appln_key'] = $appln_value;
print "The appln array element key is $appln_key and value is $appln_value.<p>\n";
}
The result was 'close', but not close enough for the following reasons:
The array's 'key' contained the 'single quotes' around it, e.g.:
the printout showed:
The appln array element key is \\'retail\\' and value is retail.
Q: why are the single quotes even there in the first place around the word 'retail' (likewise for the other elements)?
Also, in the html form shown above, there is an error:
Notice: Undefined index: retail
Notice: Undefined index: commercial
What's going on?
Thank you.