0

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...

3
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by Joshua Kidd
0

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.

0

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.

0

Nope, that doesn't need to be: if the page is called without POST, you will always get that notice.

0

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.

0

Oh Okay i put that error_reporting(0); and that fixed the problem. Thanks guys

Edited by Joshua Kidd: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.