-1

ページが正しく処理されることを期待して、いくつかの異なる方法を試し、同様の質問をいくつか調べました。しかし、私は失敗しました。Undefined variable という 3 つの通知が表示されます。

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 に答える