I am trying to get rid of all the error messages strewn across a contact form I have on my localhost configuration
Every time I make an edit to the error_reporting line, the MariaDB server stops working as if a file is missing, I know this file isn’t missing because I have seen the said file in the folder
The error message that is strewn across the contact form is
Notice: Undefined variable: nameField in D:\xampp\htdocs\xxxx\contact.php on line 75
That is one sample because there are multiple error messages of a similar nature
That means that the variable is undefined. You need to define it.
The error is definitely in the contact.php file and most likely on or just before line 75.
The same will be the case for all the other errors - something not right in the PHP file it refers to on or just before the line referred to.
No change to your error reporting is required unless you want to get rid of everything from the first & onward so as to not hide some of the errors.
If you’re still getting that error message then you probably need to set the variable somewhere else as well. It is probably better to fix the errors and warnings rather than change the level of error reporting on your development system.
You will - if you get the error locally then you will also get it anywhere else. The only difference is that on live servers it is common to suppress displaying the error on the page itself (where it makes it easier for someone to break into your site) and simply record the error in a log file instead.
The whole purpose of displaying ALL errors on your local machine is so that you can FIX them rather than having the live copy generate huge log files.
(for example - I just upgraded my local server from PHP 5.3 to PHP 5.6 and are now seeing error messages that were not there before which I now need to fix before I can make the same PHP update to the live copy of my site).
I think OP is missing the point. Yes, it is important to get rid of these errors, but if you’re going to suppress it. You’re being lazy and shouldn’t be called a developer (don’t kill me if I touched a nerve).
The problem you are not understanding is that if you get rid of this error and more errors show up, then you can correct those errors as well and by the time you are done correcting any errors in any files. both live server and local server have no errors.
I probably bet the only reason why the live server didn’t show these errors is either the hoster you are using don’t have error logging and display on as default or you turned them off by yourself. This is not a good idea.
Moreover, if you keep suppressing errors, more errors on other pages might occur where you don’t want them to. So it is best that you correct this now before other people see more errors and complain about them.
having the errors to display for everyone is not a good idea - having them logged so you can see them later so as to fix them is essential (you might even say critical) - of course if you have tested properly before uploading then all the errors should have already been fixed (but the chances of that are remote as someone is bound to try doing something you didn’t think to test for at some point).
The most important part of all of this though is to make sure that ALL errors on your local system are displayed so that they can be more easily spotted and fixed.
Is the value for $nameField coming from a form? If it is check then check the spelling of the field name and that the form method ties up with the superarray (either $_GET or $_POST) that you’re trying to access the value from (hopefully you’re validating the submitted data)
There is no spelling errors and it does tie with super array $_POST. I had suppressed these errors before, but unlike before, if I attempt to suppress them this time around, MariaDB (what a stupid name for a DB server), I originally had MySQL and that is why the suppression worked. If I attempt suppression with MariaDB, it gives out an error message, saying that a file that is needed for MariaDB to work