我有一个表格:
function show_welcome()
{
print_r($_REQUEST);
global $error_flag , $date_error_flag;
$first_name = isset($_REQUEST['Fname']) ? $_REQUEST['Fname'] : "";
$last_name = isset($_REQUEST["Lname"]) ? $_REQUEST["Lname"] : "";
$phone = isset($_REQUEST["Phone"]) ? $_REQUEST["Phone"] : "";
$height = isset($_REQUEST["Height"]) ? $_REQUEST["Height"] : "";
$birthday = isset($_REQUEST["Bday"]) ? $_REQUEST["Bday"] : "";
$sex = isset($_REQUEST["Sex"]) ? $_REQUEST["Sex"] : "";
$history = isset($_REQUEST["Hx"]) ? $_REQUEST["Hx"] : "";
$age = isset($_REQUEST["Age"]) ? $_REQUEST["Age"] : "";
?>
<form method='post' action="" >
<center>
First Name: <input type='text' name='Fname' maxlength = '10' value = <?php echo $first_name ?> ></input>
Last Name: <input type='text' name='Lname' maxlength = '20' size = '25' value = <?php echo $last_name ?> ></input><br />
</center>
<div id="I1">Ten Characters</div> <div id="I2"> Twenty Characters</div><br /><br />
<center>
Phone: <input type="text" name="Phone" value = <?php echo $phone ?> ></input>
Height: <input type="text" name="Height" value = <?php echo $height ?> ></input><br ></center>
<div id="I3">XXX-XXX-XXXX</div> <div id= "I4"> Inches</div><br /><br />
<center>Birthday: <input type='text' name='Bday' value = <?php echo $birthday ?> ></input><br />
<?php
printf(" \t\t\t\t YYYY-MM-DD \n\n");
?>
<p ><input type="radio" name="Sex" value = <?php echo $sex ?> value = "0"/>Male
<input type="radio" name="Sex" value = <?php echo $sex ?> value = "1"/>Female </p >
Hx: <br />
<textarea style="overflow: scroll" cols="60" rows="10" wrap="hard" name="Hx" value = <?php echo $history ?> ></textarea> <p />
<input type="text" hidden="true" name="Age" ></input>
<br /><br /><input type="submit" />
<br /><br /><input type = "reset" value="Clear Form"/></center>
<input type=hidden name='welcome_already_seen' value='already_seen'>
</form>
<?php
}
该表格由用户填写,然后检查有效格式。无效格式会触发错误消息,并且脚本会返回表单。我希望显示所有输入的数据,以便用户可以更轻松地进行更正。除历史记录 (Hx) 外,所有内容都重新输入到表单中。
$_REQUEST 包含历史:
数组 ( [Fname] => 44444444 [Lname] => Jones [电话] => 123-123-4656 [身高] => 62 [生日] => 1989-03-05 [性别] => 0 [Hx] = > 好 pt [年龄] => [welcome_already_seen] => already_seen)
作为一个附带问题,我如何确保在重新输入数据时重新检查正确的单选按钮。
请提供建议和帮助。
谢谢