proper method to do the following...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux