-1

我尝试了几种不同的方法,并查看了几个类似的问题,希望能正确处理我的页面。然而,我一直没有成功。我收到三个提示未定义变量的通知:

Notice: Undefined index: username
Notice: Undefined index: password
Notice: Undefined index: dataAction
$usernameLabel = "Username:";
$usernameName = "username";
$usernameValue = $_POST[$usernameName];

$passwordLabel = "Password:";
$passwordName = "password";
$passwordValue = $_POST[$passwordName];

$submitName = "dataAction";
$submitValue = "Submit";
4

1 回答 1

2

您应该检查该值是否已设置

$usernameLabel = "Username:";
$usernameName = "username";

 //check if the $_POST array is populated and contain this key and there is a value associated to it
if(isset($_POST[$usernameName]))
{
   $usernameValue = $_POST[$usernameName];
}
于 2013-01-11T17:40:18.677 回答