SOLVED!
Seems that I only had to add isset to my check.
if(isset($_POST['submitBtn'])) { I am validating and processing some date that I want to get from my HTML form. I placed this form inside a $form variable, this way I can send people back to the register form. But somehow my PHP can't find my submit button ans gives me the error: undiefined index. Note that the PHP is in the same file as the form.
Because my form is rather long, I just post the submitbutton with the example:
$form = "<form action='register.php' method='post'> <table> <tr> <td></td> <td><input type='submit' name='submitBtn' value='Register'></td> </tr> </table> </form>"; Part of my PHP:
if($_POST['submitBtn']) { $firstname = strip_tags($_POST['firstname']); $lastname = strip_tags($_POST['lastname']); $username = strip_tags($_POST['username']);
if(isset($_POST['submitBtn']))and close your conditional}- you also need toecho $form;somewhere. Plus,Undefined index... what?- That's rather b-r-o-a-d.