vendredi 28 avril 2017

How to get if-loop to start once conditions are met, without a submit button

I'd like to execute an if-loop where the values within the two fields are compared to the table bestilling within the connected database and then, if there are values within the database that are the same as the ones within the field, will the submit button at the bottom be enabled. However I'm not sure how to get the if-loop to start once the two fields are filled out, help?

<li>Hva er deres Kundenummer?
<input type="text" name="KundeID"> </li>
<li>Hva er deres Passord?
<input type="text" name="password"> </li><br>
<?php
$tjener = "localhost";
$brukernavn = "root";
$passord = "";
$database = "gyldentag takeaway";

$kobling = new mysqli($tjener, $brukernavn, $passord, $database);

function login ($KundeID, $password) {
$result = mysqli_query($con, "SELECT * FROM kunder WHERE KundeID='$KundeID' AND password='$password'");
while($row = mysqli_fetch_array($result)) {
    $success = true;
}
if($success == true) {
    echo 'document.getElementById("Button").disabled = false;';
} else {
    echo '<div class="alert alert-danger">Brukernavn eller Passord er ukorrekt venligst prøv igjen</div>';
}
}
?>

Aucun commentaire:

Enregistrer un commentaire