コードに問題があります。[送信]をクリックすると、エラーチェックは正常に機能しますが、以前の値は表示されなくなります。私のコードの問題は何ですか?ありがとうございました
<?php
$FnameErr = $LnameErr = $GenderErr = $TimeErr = $EduErr = $ApatErr = $QuoteErr = "";
if($_SERVER["REQUEST_METHOD"] == "POST")
{
if(empty($_POST["Fname"]))
{
$FnameErr = "Enter First Name";
}
else
{
$Fname = $_POST["Fname"];
}
if(empty($_POST["Lname"]))
{
$LnameErr = "Enter Last Name";
}
else
{
$Lname = $_POST["Lname"];
}
if(empty($_POST["gender"]))
{
$GenderErr = "Enter Gender";
}
else
{
$gender = $_POST["gender"];
}
if(empty($_POST["living"]))
{
$ApatErr = "Enter living";
}
else
{
$living = $_POST["living"];
}
if(empty($_POST["quote"]))
{
$QuoteErr = "Enter Quote";
}
else
{
$quote = $_POST["quote"];
}
if(empty($_POST["education"]))
{
$EduErr = "Enter Education";
}
else
{
$education = $_POST["education"];
}
if(empty($_POST["TofD"]))
{
$TimeErr = "Enter Time";
}
else
{
$TofD = $_POST["TofD"];
}
if(isset($Fname) && isset($Lname) && isset($gender) && isset($living) && isset($quote) && isset($TofD))
{
echo "Hello, " . $Fname . " " . $Lname . ".<br />";
echo "You are " . $gender . ", and you live in ";
foreach($living as $f)
{
echo $f . "<br />";
}
echo "You're favorite time is " . $TofD . ", and you passed " . $education . "!<br />";
echo "<i>" . $quote . "</i><br />";
}
}
?>