I have searched on stackoverflow about the undifined variable, and I couldn't find anything that solved my problem.
this is my PHP code:
if(isset($_POST['login'])){
$username =mysql_real_escape_string( $_POST['naam']);
$password =md5( $_POST['wacht']);
$check_user = "select * from users where gebruikersnaam='$gebruikersnaam' AND wachtwoord='$wachtwoord'";
$run =mysql_query($check_user);
if(mysql_num_rows($run)>0){
$_SESSION['naam']=$gebruikersnaam;
echo "<script>window.open('welkom.php','_self')</script>";
}
This is my HTML code:
<div id=content>
<form method='POST' action='login.php'>
Gebruikersnaam:<br>
<input type='text' name='naam' />
<br>
<br>
Wachtwoord:<br>
<input type='password' name='wacht' />
<br>
<br>
<input type='submit' name='login' value='Inloggen' />
</form>
<br>
Niet geregistreerd? <a href='registratie.php'>Klik hier.</a>
</div>
I can't see where my problem is, it says I have a undefined variable on this line: $check_user = "select * from users where gebruikersnaam='$gebruikersnaam' AND wachtwoord='$wachtwoord'";
The names I use are from my database so I wouldn't make a mistake with the names.
Could you people help me? It would be a real time saver because I can't find the problem.