proper method to do the following...
| From: | Hugh Beaumont | Date: | Wed, 06 Oct 2004 13:53:34 +0000 |
| Subject: | proper method to do the following... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-198751@lists.php.net to get a copy of this message | ||
I've been working with
error_reporting(E_ALL)
set lately trying to write code that does not give notices or errors.
I have not been able to solve the following:
given a form with a checkbox that may or may not be set, we'll call it "exact" as in
<input type = "checkbox" name = "exact">
the following code outputs :
Notice: Undefined index: exact in search.php on line 10
code :
if (!isset($_POST['exact'])) { <--------- line 10
$_POST['exact'] == false;
}
if ($_POST['exact'] == "checked") <------ also here
{
$exact_match_only = true;
}
else {
$exact_match_only = false;
}
I understand why it is giving the notice but I'm not sure how to make it stop.
What is the proper way to set a variable so that it's non-existance will not generate
a notice?
Any ideas?
Let me know if the above is not clear. Thanks.
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com