0

I've tried to fix this the past hour, but it won't give a good result. The problem is that I've got a new bootstrap theme, I'm bussy with building my old system into the new theme. The only thing is that when I push on the submit It won't do anything. If I try to check the variables with var_dump it gives me null. The only problem is that I don't know why the form is wrong.

HTML

<form method="POST" class="form-horizontal">
<!-- Username -->
  <div class="form-group">
    <label class="control-label col-lg-3">Gebruikersnaam</label>
    <div class="col-lg-9">
      <input type="text" class="form-control" name="username" placeholder="Gebruikersnaam">
    </div>
  </div>
<!-- Password -->
  <div class="form-group">
    <label class="control-label col-lg-3">Wachtwoord</label>
    <div class="col-lg-9">
      <input type="password" class="form-control" name="password" placeholder="Wachtwoord">
    </div>
  </div>
  <div class="col-lg-9 col-lg-offset-3">
    <input type="submit" class="btn btn-danger" value="Inloggen">
    <input type="reset" class="btn btn-default" value="Reset">
  </div>
  <br />
</form>
<div class="widget-foot"> Nog niet geregistreerd? <a href="#">Registreer hier</a></div>

PHP

/* Start of the script.. */
if(isset($_POST['submit']))
{
 global $sFoutmelding;

  $stringaUser   =  trim($_POST['username']);
  $stringaPass   =  trim($_POST['password']);
  $smallUser     =  strtolower($stringaUser);
  $hashPass      =  hash("SHA512", $stringaPass);

    //Begin of the prepared statement.
       $stmt     = $mysqli->prepare("SELECT gebruikersnaam,wachtwoord FROM users WHERE gebruikersnaam = ?");
       $stmt->bind_param('s', $smallUser);
     $stmt->execute();
     $stmt->store_result();
     $stmt->bind_result($arrayUserName, $arrayUserPass);
     $stmt->fetch();
     $stmt->close();
    //End of the prepared statement.

  if(empty($stringaUser))
  {
    $sFoutmelding[] = 'U hebt geen gebruikersnaam opgegeven!';
  }
  if(empty($stringaPass))
  {
    $sFoutmelding[] = 'U hebt geen wachtwoord opgegeven!';
  }
  if($smallUser != $arrayUserName)
  {
    $sFoutmleding[] = 'Uw gebruikersnaam of wachtwoord klopt niet!'; 
  }
  if($hashPass != $arrayUserPass)
  {
    $sFoutmelding[] = 'Uw gebruikersnaam of wachtwoord klopt niet!';
  }
}

Thank you for helping^^

1 Answer 1

1

You can add name attribute to your submit button and check against that name on line 1.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.