0
Notice: Undefined index: user in C:\xampp\htdocs\PhpProject1\login.php

Notice: Undefined index: password in C:\xampp\htdocs\PhpProject1\login.php

运行此代码时出现此错误

if ( isset($_REQUEST['attempt']) );
{
    $link = mysql_connect('localhost', 'root', '') or die('cant connect to db');
    mysql_select_db('test_user');

    $user = mysql_real_escape_string($_POST['user']);
    $password = (mysql_real_escape_string($_POST['password']));
4

1 回答 1

2

这意味着那些关联键不在您的$_POST数组中,这意味着以下两种情况之一:

  • 您的表单字段未使用name="user"andname="password"属性
  • 您的表单标签省略了method="post"属性
于 2012-12-14T19:55:38.603 回答