so my problem is simply that this form doesn’t get submitted. When I press the submit button or the reset button nothing happens. Any ideas? (I’m using xampp if that has anything to do with it, I’m also a beginner so I don’t really have any idea what I’m doing )
This is the signUp.php :
<!DOCTYPE html> <html> <head> <meta charset="utf8"> <title>Sign Up Form</title> <link rel="stylesheet" href="../allStyles/formstyles.css?php echo time(); ?>"></head> <body> <table style="width: 30%;" align=center> <form action="/loginSystem/signUpHandler.php" method="post"></form> <tr style="background-color: #de8704"> <td colspan="2" style="padding-top: 0px; padding-bottom: 0px;"><p style="text-align: left"> Sign Up Form</p></tb> </tr> <tr> <td style="text-align:right"><label for="fname">Name <td style="text-align:left"><input type="text" id="fname" value="" placeholder="Enter name"></td> </tr> <tr> <td style="text-align:right"><label for="lname">Last Name <td style="text-align:left"><input type="text" id="lname" value="" placeholder="Enter last name"></td> </tr> <tr> <tr> <td style="text-align:right"> <td style="text-align:left"><input type="radio" name="gender1" id="gender1">Mr <input type="radio" name="gender2" id="gender2">Mrs </td> </tr> <tr> <td style="text-align:right">E-mail <td style="text-align:left"><input type="email" id="email" name="email" placeholder="Enter Email"></td> </tr> <tr> <td style="text-align:right">Phone Number<td style="text-align:left"><input type="number" id="pnumber" name="pnumber" placeholder="Enter Phone Number"></td> </tr> <tr> <td style="text-align:right"><label for="username">Username <td style="text-align:left"><input type="text" id="username" name="username" value=""></td> </tr> <tr> <td style="text-align:right">Password<td style="text-align:left"><input type="password" id="password" name="password" maxlength="8"></td> </tr> <tr> <td style="text-align:right;">Confirm <br> Password<td style="text-align:left"><input type="password" id="confpass" name="confpass" maxlength="8"></td> </tr> <tr> <td><td><input type="checkbox" value="agree" name="" id="agreed"><label for="agreed">Agree?</label></td> </tr> <tr> <td style="background-color: #de8704"> <td style="text-align: right; background-color: #de8704; padding-top: 4px; padding-bottom: 4px;"> <input class="send_button" type="submit" value="Send" id="submit" name="submitBtn"> <button class="reset_button" type="reset" id="reset" name="resetBtn">Reset</button></td> </tr> </form> </table> </body> </html>
The signUpHandler.php is :
<?php if (!isset($_POST["submitBtn"])) { header("location: ./signUp.php"); } else { echo "hello"; }
Advertisement
Answer
<form action="/loginSystem/signUpHandler.php" method="post"></form>
You closed your form tag before expected, please put your button inside of your form tags maybe it will work 😀