$_POST index issues
| From: | James G Puckett | Date: | Mon, 10 Feb 2003 15:47:49 +0000 |
| Subject: | $_POST index issues | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-135079@lists.php.net to get a copy of this message | ||
I have run into a problem with some of my code surrounding $_POST.
Below are excepts:
Sending PHP script (login.php)
<FORM METHOD=POST ACTION="/verify_login.php">
<B><I>Username</B></I>
<INPUT NAME="username_given" SIZE="20">
<B><I>Password</B></I>
<INPUT NAME="password_given" TYPE="password" SIZE="20">
<INPUT TYPE="submit" VALUE="Login">
</FORM>
Receiving script (verify_login.php)
foreach ($_POST as $key => $value ) {
echo "<!-- $key ==> $value -->\n";
}
$db_connection = odbc_connect( $GLOBALS["db_dsn"],
$GLOBALS["db_username"], $GLOBALS["db_password"] );
echo "<!-- username_given ==> $_POST['username_given'] -->\n";
$query = "select username, active, password, clec_id from users
where USERNAME=\"$_POST['username_given']\"";
I get the following errors:
PHP Notice: Undefined index: 'username_given' in
/var/www/e911.e-c-group.com/verify_login.php on line 19
PHP Notice: Undefined index: 'username_given' in
/var/www/e911.e-c-group.com/verify_login.php on line 21
However, the for loop above produces the following output.
<!-- username_given ==> jpuckett -->
<!-- password_given ==> password -->
Any ideas what I am doing wrong?
James G Puckett
ECG, Inc.