On a remote server there is no problem, but in localhost (xampp 3.1.) I cannot turn off reporting notices.
Write this code in start of your file.
ini_set('display_errors', 0);
error_reporting(E_ERROR | E_WARNING | E_PARSE);
Edit1
If you did not want to use above lines then you have to write @
before $_POST
to suppress notices, like
$Fname = @$_POST["Fname"];
Edit 2
With this line error_reporting = E_ALL & ~E_NOTICE
also change display_errors = Off
although its bad programming practices.
If your running XAMPP and want to turn off notices (or other features):
1. Make sure your editing the right INI file (select config from the control panel)
2. Turn display_errors=on
3. Turn error_reporting=E_ALL & ~E_NOTICE (This will only suppress notice errors)
4. Important - Make sure XAMPP is not overriding your settings further down the file (read the notice above the first set of settings)
5. Stop and Start Apache after saving the file
Try to do a phpinfo();
just before your $Fname = $_POST["Fname"];
line. What's the error_reporting property value ? See this or this to understand the value displayed in the table.
If it's not what you expected, check that the property is not changed by php.
It's also possible you edited the wrong php.ini file : XAMPP tends to copy the original php.ini file and create his own. Use phpinfo();
, search for 'php.ini' string in the table : you will find the path of the php.ini file used.
Last thing, maybe the problem is that you did not properly restarted apache after you changed php.ini file. The thing is that xamp is a distinct process of the apache service. Closing XAMP do not make apache service to be stopped, you better use XAMPP Control Panel to stop/start apache.
The most simple way to solve this problem is as follows: 1. Turn off Apache server 2. Go to c:\xampp\php\ 3. Rename php.ini to php.ini.bak 4. Rename php.ini-production to php.ini 5. Turn on the server again.
It has a flaw that it reverts everything to production mode. but you can always undo this.
Remember to uncomment error_reporting in php.ini by removing the ';' before 'error_reporting'.
It really wasted my time here