How to solve undefined index notices

Hi,
I am trying to fix a lot of undefined index notices in my classified ads php website. I've read lots of post here, and I thought that it is easy to remove those notices, just using isset(). In effects, notices disappears, but some times the script stops from working as it should. Can someone explain, in general and in poor words, how to manage this notice? E.g., "use isset if you deal with a $_ variable, or use empty if you deal with a $var variable" and so on? (if it is possible to write a rule like that, I don't even know!)
jimgordonAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
gamebitsConnect With a Mentor Commented:
if(isset($_POST['var']))

if(isset($var))

both should work, the question is what is the script is suppose to do if the variable is not set
0
 
gamebitsCommented:
You can always put at the topof your page

error_reporting(0);

this will hide all the notices warnings and errors, in case of a major error (an error that will break the script) you will end up with a blank page.

Not exactly a good programing tactic but rather a quick fix.
0
 
jimgordonAuthor Commented:
Yes, I know. My intent is to fix those notices, not to hide them.
0
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
gamebitsCommented:
Then you need to use the isset() function or to assign a default value at the top of the script, value to be use by the script if the variable is not overwritten by a $_POST['var'] value.
0
 
jimgordonAuthor Commented:
Why if variable is not a $_ ? E.g.: let's pretend variable is 'x'.
Can I still use isset?
The problem is that I'm looking for a general rule, since I have spent all day in adding isset() in front of those variable that caused notices, and  at the end I've found that lots of thing don't work anymore properly.
0
 
jimgordonAuthor Commented:
the problem is that aI have a lot of these notices all around the website. I cannot post here notice by notice. Is there a way to hire someone of you here and pay for a finished job?
0
 
gamebitsCommented:
I don't think it's in accordance with EE rules to post a paid job offer, but I know as a programmer we can can post our email address in our profile and I know some offer to tackle projects.

What is the website all about? How many pages? Is it a script that you bought and try to modify? May be they offer some kind of support if it's the case.
0
 
jimgordonAuthor Commented:
Yes, I purchased this script from a developer, but i don't think he would solve these notices for me only. It is a classified ads script you can see at www.annunci.cc. It is about 90 pages (less than 1Mb). Page affected are less than 90, anyway.
0
 
gamebitsCommented:
Beside EE there is quite a few website where you can post a project and have programers bid on it

www.rentacoder.com
www.php-freelancers.com
www.getafreelancer.com
www.scriptlance.com

are a few of them
0
 
gamebitsCommented:
The script is Italian so I guess the comment in the script are also written in Italian, having a programer who is fluent in the language might help a lot fixing those issue for you.
0
 
jimgordonAuthor Commented:
No, the script is entirely in english. I only changed the language file. I can send you the english file if you need.
0
All Courses

From novice to tech pro — start learning today.