0
我有一個表單頁面命名reg_apply_form.php和動作頁完整的形式而得名preview.php 當我點擊預覽按鈕,我的動作頁面顯示所有值。如果我認爲,我的信息是錯誤的,那麼我將點擊返回按鈕。但問題是,如果我點擊返回按鈕,我所有的價值都被刪除。如果點擊返回按鈕,我想返回所有值的表單頁面。 我的兩個頁面代碼如下:如何去表單頁面與價值從操作頁面後點擊後退按鈕
窗體頁代碼:
<!DOCTYPE html>
<head>
</head>
<body id="body">
<form action="preview.php" method="post" class="form-inline vh_pre_reg_form">
<div class="form-group">
<label>First Name</label>
<input name="fname" id="one" type="text" class="form-control" placeholder="Your First Name">
</div>
<div class="form-group">
<label>Last Name</label>
<input name="lname" id="two" type="text" class="form-control" placeholder="Your Last Name" />
</div>
<div class="form-group">
<label>Email</label>
<input name="email" id="txtEmail" type="email" class="form-control" placeholder="Your Email" />
</div>
<div class="form-group">
<label>Address</label>
<input name="address" type="text" id="four" class="form-control" placeholder="Your Address" />
</div>
<div class="form-group">
<label>Phone Number</label>
<input name="vh_rg_phone" type="text" pattern="[0-9]{6,}" id="vh_rg_phone" class="form-control" placeholder="Your Phone Number" />
</div>
<div class="form-group">
<label>Mobile Number</label>
<input name="vh_rg_mob" type="number" pattern="\d{11}" id="vh_rg_mob" class="form-control" placeholder="Your Mobile Number" />
</div>
<div class="form-group">
<label>Father's Name</label>
<input name="vh_reg_father_name" type="text" id="vh_reg_fname" class="form-control" placeholder="Your Father's Name" />
</div>
<div class="form-group">
<label>Father's Contact</label>
<input name="vh_reg_father_con" type="number" pattern="\d{11}" id="vh_rg_fcontact" class="form-control" placeholder="Your Father's Contact" />
</div>
<div class="form-group">
<label>Mother's Name</label>
<input name="vh_reg_mother_name" type="text" id="vh_reg_mname" class="form-control" placeholder="Your Mother's Name" />
</div>
<div class="form-group">
<label>Mother's Contact</label>
<input name="vh_reg_mother_con" type="number" pattern="\d{11}" id="vh_reg_mcontact" class="form-control" placeholder="Your Mother's Contact" />
</div>
<div class="form-group">
<label>Guardian Name</label>
<input name="vh_reg_gaurdi_name" type="text" id="vh_reg_guardi_name" class="form-control" placeholder="Your Guardian Name" />
</div>
<div class="form-group">
<label>Guardian Contact</label>
<input name="vh_reg_gaurdi_con" type="number" pattern="\d{11}" id="vh_rg_guardi_contact" class="form-control" placeholder="Your Guardian Contact" />
</div>
<div class="form-group table">
<label>Date of Birth <strong>*</strong></label>
<input type="date" id="birthday" name="birth_date" />
</div>
<div class="form-group">
<label>Password Number</label>
<input name="mainpass" type="password" id="mainpass" class="form-control" placeholder="Make Your Password" />
</div>
<div class="form-group">
<label>Confirm Password</label>
<input name="conpass" type="password" id="conpass" class="form-control" placeholder="Type Your Password Again" />
</div>
<input name="submit" id="btnValidate" type="submit" value="Preview"/>
<input type="reset" value="Clear All"/>
</form>
</body>
</html>
而且我的行動網頁代碼:
<?php
if($_POST && isset($_POST['mainpass'], $_POST['fname'], $_POST['lname'], $_POST['conpass'], $_POST['email'])){
if($_POST['mainpass'] == $_POST['conpass']){
$fname = "$_POST[fname]";
$lname = "$_POST[lname]";
$email = "$_POST[email]";
$address = "$_POST[address]";
$student_phone = "$_POST[vh_rg_phone]";
$student_mobile = "$_POST[vh_rg_mob]";
$religion = "$_POST[religion]";
$father = "$_POST[vh_reg_father_name]";
$father_contact = "$_POST[vh_reg_father_con]";
$mother = "$_POST[vh_reg_mother_name]";
$mother_contact = "$_POST[vh_reg_mother_con]";
$guardian = "$_POST[vh_reg_gaurdi_name]";
$date_of_birth = "$_POST[birth_date]";
$guardian_contact = "$_POST[vh_reg_gaurdi_con]";
$password = "$_POST[mainpass]";
} else{header("Location: go.php");}
}
else{
header("Location: no.php");
}
?>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<title></title>
</head>
<body>
<form action="password.php" method="post" class="form-inline vh_pre_reg_form">
<div class="form-group">
<label>First Name</label>
<span><?php echo $fname; ?></span>
</div>
<div class="form-group">
<label>Last Name</label>
<span><?php echo $lname; ?></span>
</div>
<div class="form-group">
<label>Email</label>
<span><?php echo $email; ?></span>
</div>
<div class="form-group">
<label>Address</label>
<span><?php echo $address; ?></span>
</div>
<div class="form-group">
<label>Phone Number</label>
<span><?php echo $student_phone; ?></span>
</div>
<div class="form-group">
<label>Mobile Number</label>
<span><?php echo $student_mobile; ?></span>
</div>
<div class="form-group">
<label>Father's Name</label>
<span><?php echo $father; ?></span>
</div>
<div class="form-group">
<label>Father's Contact</label>
<span><?php echo $father_contact; ?></span>
</div>
<div class="form-group">
<label>Mother's Name</label>
<span><?php echo $mother; ?></span>
</div>
<div class="form-group">
<label>Mother's Contact</label>
<span><?php echo $mother_contact; ?></span>
</div>
<div class="form-group">
<label>Guardian Name</label>
<span><?php echo $guardian; ?></span>
</div>
<div class="form-group">
<label>Guardian Contact</label>
<span><?php echo "here will be date" . $guardian_contact; ?></span>
</div>
<div class="form-group table">
<label>Date of Birth <strong>*</strong></label>
<span><?php echo $date_of_birth;?></span>
</div>
<input name="submit" id="btnValidate" type="submit" value="Submit"/>
<a href="reg_apply_form.php"><input type="button" value="Back"/></a>
</form>
</body>
</html>
我不知道我怎麼能做到這一點。請幫幫我。如果可能的話,請用完整的代碼回答我。 謝謝
@@ P.Frank謝謝你的回答。但請不要分鐘,我已經嘗試了很多次,但它沒有工作。你能給我一個明確的代碼嗎?這對我來說非常重要。謝謝 –
我已經更新了我的答案。請嘗試。它工作正常 –
@@ P.Frank ..你很棒...現在它工作..非常感謝:) –