On a remote server there is no problem, but in localhost (xampp 3.1.) I cannot turn off reporting notices.
<?php
$Fname = $_POST["Fname"];
...
result:
Notice: Undefined index: Fname in D:\xampp\htdocs\xx\php01\form01.php on line 6
php.ini
; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
; Development Value: E_ALL
; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT
; http://php.net/error-reporting
error_reporting = E_ALL & ~E_NOTICE //shouldn't this line turn off notice reporting ?
Any suggestion ?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With