$_post and array question
| From: | Amon | Date: | Mon, 17 May 2004 12:43:05 +0000 |
| Subject: | $_post and array question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-186437@lists.php.net to get a copy of this message | ||
Best readers,
//PHP version: 4.3.6
I have question concerning the following issue:
I have a HTML input element of the type check.
<input type="checkbox" name="test_arr[]">
let assum this checkbox is unchecked. The checkbox is part of a form.
Now we gonna submit this form (post) and gonna catch the POST variable
test_arr like this:
$arr_test = $_POST["test_arr"];
This will result in a novice error "Undefined index: "
Of course because test_arr does not exist. It's unchecked.
Now we gonna do the following:
We immediately put the $_POST["test_arr"] into a function and then we assign
$_POST["test_arr"] to $arr_test like this:
functionX($_POST["test_arr"])
$arr_test = $_POST["test_arr"];
Knowing that $_POST["test_arr"]) does not exist.. this code will not result
in a error.
Is this a bug,error,etc? Should this not also produce a novice error?
Thanks for reading,
Amon