This is going to sound really stupid, but I cannot figure out why I am getting this error.
I have created a selection box, named "query_age" in my html form:
In the corresponding php form, I have:
$query_age = $_GET['query_age'];
When I run the page, I get this error:
Notice: Undefined index: query_age in index.php on line 19
I don't understand why this is happening, and I'd love to know how to make it go away.
Answer
I don't see php file, but that could be that -
replace in your php file:
$query_age = $_GET['query_age'];
with:
$query_age = (isset($_GET['query_age']) ? $_GET['query_age'] : null);
Most probably, at first time you running your script without ?query_age=[something]
and $_GET
has no key like query_age
.
No comments:
Post a Comment