I am making a register page and I have one error.
if ($_POST['submit'])
I keep getting Notice: Undefined index: submit in C:\xampp\htdocs\globallypictured\register.php on line 6
NO IDEA WHY. . . Can someone please help...
I am making a register page and I have one error.
if ($_POST['submit'])
I keep getting Notice: Undefined index: submit in C:\xampp\htdocs\globallypictured\register.php on line 6
NO IDEA WHY. . . Can someone please help...
That's not an error, it's a notice. You can turn off displaying them by calling error_reporting(0);
, for example. This notice means, that $_POST does not contain anything for the index 'submit'. Don't worry about it.
Check the name of your submit button it should match what you put inside the $_POST[] array. I would guess that you capitalized the name on the button or forgot it completely.
Nope, that doesn't need to be: if the page is called without POST, you will always get that notice.
The poster was creating a registration page and given the level of the question the most likely scenario is that there is a naming mismatch. Since the poster did not mention they were using AJAX it is highy unlikely that he is passing POST variables any other way.
By setting error_reporting(0); you are just masking the problem. If you are really interested in passing POST variables by some other method it would be best to test the POST array with the isset() function. This way the user has knowledge that the data is not coming from a form and can either allow or reject the request based upon that knowledge. Setting the error reporting off just opens the site to XSS attacks.
Never assume always test.
Oh Okay i put that error_reporting(0); and that fixed the problem. Thanks guys
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.