[Solved] Notice: Undifined variable: [value] [duplicate]


You do not check if the following variables are set before you assign them.

$_POST['naam']
$_POST['wacht']

As you did with $_POST['login'] you can use isset to check they exist before assignment.

if (isset($_POST['naam'] && isset($_POST['wacht']) {
    // Do something...
}

In addition to this in the query you are using the variables $gebruikersnaam and $wachtwoord which you don’t appear to be referencing anywhere else? So after some google translating I’m guessing that you intended for this bit of code:

$username =mysql_real_escape_string( $_POST['naam']);
$password =md5( $_POST['wacht']);

To be the following:

$gebruikersnaam = mysql_real_escape_string($_POST['naam']);
$wachtwoord     = md5($_POST['wacht']);

Hopefully that helps, just a bit of a side note though, I would really advise reading over http://www.phptherightway.com/ and getting familiar with some of the best practices for PHP.

In your code I would attempt to refactor it and utilise password_hash() and mysqli_* as MD5() is not secure and the mysql_ extension has been removed in the latest version of PHP and was deprecated before that.

2

solved Notice: Undifined variable: [value] [duplicate]