Error: Undefined index: Password in C and error Strict standards: Only variables should be passed by reference

0

error regarding the same line of code:

$stmt->bindParam(':Password', password_hash($_POST ['Password'], PASSWORD_BCRYPT));

That Accumulate and register the information entered in the form with the following line

<input type="Password" placeholder="Password" name="Password">

the Password field is also correctly defined with "P" in MySql.

Complete block:

if(!empty ($_POST['Username']) && !empty($_POST['Password']));



$sql ="INSERT INTO users (Username,Password) values (:Username, :Password)";
$stmt= $conn->prepare ($sql);
$stmt->bindParam (':Username', $_POST['Username']);
$stmt->bindValue(':Password', password_hash($_POST ['Password'], PASSWORD_BCRYPT));

    if ($stmt-> execute()  ):
        die('success');
        else:  ................

Help please?

    
asked by anonymous 01.10.2016 / 21:14

1 answer

1
$email =  $_POST['email'];
$username = $_POST['username'];
$password = password_hash($_POST['password'], PASSWORD_BCRYPT);

$stmt->bindParam(':email', $email);
$stmt->bindParam(':username', $username);
$stmt->bindParam(':password',$password);
    
12.11.2016 / 12:24