Diego
Diego

Reputation: 4101

Form not submitting data

I have a sign up form in html, but it's not submitting any data to the php file. Weird thing is, to me an exactly the same looking form on the same page does work and this one used to work. I probably somewhere changed something accidently.

The form:

<form action="http://test.com/register.php" method="POST" enctype="multipart/form-data">
  <fieldset>
    <div align="left">
    <label>Username</label>
    <input type="text" required class="span11" name="fUsername" id="Username" placeholder="username">

<label>Password</label>
    <input type="password" required class="span11" name="fPassword" id="Password" placeholder="password">

    <label>Retype password</label>
    <input type="password" required class="span11" name="fRetypepassword" id="Retypepassword" placeholder="retype password">

    <label>Phone number</label>
    <input type="text" required class="span11" name="fPhone" id="Phone" placeholder="+... international format">

    <label>E-Mail</label>
    <input type="email" required class="span11" name="fEmail" id="Email" placeholder="e-mail">
<br><br>
    <button type="submit" class="btn btn-info">Register</button>
  </div>
  </fieldset>
</form>

The PHP:

$username = htmlspecialchars($_GET['fUsername']); 
$password=htmlspecialchars($_GET['fPassword']);
$passwordmatch=htmlspecialchars($_GET['fRetypepassword']);
$email=htmlspecialchars($_GET['fEmail']);
$phone=htmlspecialchars($_GET['fPhone']);

echo $username;

Upvotes: 1

Views: 57

Answers (1)

Joe Pietroni
Joe Pietroni

Reputation: 826

The form is sending data with method POST but you are trying to read it from $_GET.

Try:-

$username = htmlspecialchars($_POST['fUsername']); 
$password = htmlspecialchars($_POST['fPassword']);
$passwordmatch = htmlspecialchars($_POST['fRetypepassword']);
$email = htmlspecialchars($_POST['fEmail']);
$phone = htmlspecialchars($_POST['fPhone']);

Upvotes: 6

Related Questions