Password passed from simple form not working in mysql connect

This should be easy but makes no sense … have a simple form for entering the password … the mysql connection works if I enter the password directly in $db_pwd=“xxx” … when I pass it from the form it will not connect … added the code in the die to display the password and len to see if I entered wrong but everything matches. What am I missing?

<?php $db_host = "xxx"; $db_user = "xxxt"; $db_pwd = $_POST['password']; //$db_pwd = "xxx"; $database = "xxx"; if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can't connect to database Check PASSWORD " .$db_pwd . " LEN=" . strlen($db_pwd)); if (!mysql_select_db($database)) die("Can't select database"); ?>

$_POST[‘password’]; should have been $_POST[“password”]; … strange that it still displayed correctly in the error.

Sponsor our Newsletter | Privacy Policy | Terms of Service