2017-11-24 9 views
0

1 페이지의 다음 정보를 2 페이지의 숨김 파일로 전달해야합니다. 추가 정보가 2 페이지에 추가되고 모든 입력 필드가 3 페이지에 표시되어야합니까?1 페이지의 입력 필드를 2 페이지의 숨겨진 필드로 전달한 다음 페이지 2에서 숨겨진 필드를 자바 스크립트에서 표시하려면 어떻게해야합니까?

form method="POST" action="confirm.php" onsubmit="return checkForm(this);"> 

     <p><label>Interest:</label></p> 
     <input type="checkbox" name="fund" value="fund"/><span>Fund Raising</span> 
     <input type="checkbox" name="sponsor" value="sponsor" /><span>Sponsorship</span> 
     <input type="checkbox" name="vol" value="vol" /><span>Volunteer</span><div></div> 

     <p><label for="signUpNewsletter">Sign up for newsletter: 
     </label></p> 
     <input type="radio" name="signUpNewsletter" value="Yes"> Yes 
     <input type="radio" name="signUpNewsletter" value="No"> No 

     <p><label for="desc">Comments:</label></p> 
     <textarea name="desc" id="desc" rows="10" cols="30"></textarea> 

     <p><label for="referred"> Referred by:</label></p> 
     <input type="text" name="referred" /> 
     <?php 
      if(isset($_POST["submit"])) 
     { 
      $username= $_POST["username"]; 
      $pwd1= $_POST["pwd1"]; 
     } 
     ?> 

     <input type="hidden" name="username" value="<?php echo $_POST["username"]; ?>"> 
     <input type="hidden" name="pwd1" value="<?php echo $_POST["pwd1"]; ?>"> 
     <input type="hidden" name="pwd2" value="<?php $_POST["pwd2"]; ?>"> 
     <input type="hidden" name="firstName" value="<?php echo $_POST["firstName"]; ?>"> 
     <input type="hidden" name="lastName" value="<?php echo $_POST["lastName"]; ?>"> 
     <input type="hidden" name="email" value="<?php echo $_POST["email"]; ?>"> 
     <input type="hidden" name="phone" value="<?php echo $_POST["phone"]; ?>"> 
     <input type="hidden" name="fund" value="<?php echo $_POST["fund"]; ?>"> 
     <input type="hidden" name="sponsor" value="<?php echo $_POST["sponsor"]; ?>"> 
     <input type="hidden" name="vol" value="<?php echo $_POST["vol"]; ?>"> 
     <input type="hidden" name="sign" value="<?php echo $_POST["sign"]; ?>"> 


     <input type="submit" name="submit1" value="Register"> 
    </form> 

페이지를도 2 페이지로 페이지 (1)로부터 입력되는 정보를 표시하는 3 개 요구 :

<section id="pageFormContent"> 

    <p>You have successfully registered!</p> 

    <?php 

     if(isset($_POST["submit1"])) 
     { 
      $username= $_POST["username"]; 
      $pwd1= $_POST["pwd1"]; 
      $pwd2= $_POST["pwd2"]; 
      $firstName= $_POST["firstName"]; 
      $lastName= $_POST["lastName"]; 
      $email= $_POST["email"]; 
      $phone= $_POST["phone"]; 
      $fund= $_POST["fund"]; 
      $sponsor= $_POST["sponsor"]; 
      $vol= $_POST["vol"]; 
      $sign= $_POST["sign"]; 
      echo $username; 
      echo $pwd1; 
      echo $pwd2; 
      echo $firstName; 
      echo $lastName; 
      echo $email; 
      echo $phone; 
      echo $fund; 
      echo $sponsor; 
      echo $vol; 
      echo $sign; 
     } 




    ?> 



</section> 
2는 다음

<form method="POST" action="interests.php" onsubmit="return checkForm(this);"> 
     <p>Use tab key to move from one input field to the next.</p> 
     <label for="userName">Username:</label> 
     <input type="text" name="username" placeholder="Enter your Username" /><div><span id='errorusername'></span></div> 

     <label for="passWord1">Password:</label> 
     <input type="password" name="pwd1" placeholder="Enter your Password" /><div><span id='errorpwd1'></span></div> 

     <label for="passwordword2">Verify your Password: 
     </label> 
     <input type="password" name="pwd2" placeholder="Enter in your Password again" /><div><span id='errorpwd2'></span></div> 

     <label for="firstName">First Name: 
     </label> 
     <input type="text" name="firstName" placeholder="Enter your First Name" /><div><span id='errorfirstName'></span></div> 

     <label for="lastName">Last Name: 
     </label> 
     <input type="text" name="lastName" placeholder="Enter your Last Name" /><div><span id='errorlastName'></span></div> 

     <label for="email">Email: 
     </label> 
     <input type="text" name="email" placeholder="Enter your Email Address" /><div><span id='erroremail'></span></div> 

     <label for="phone">Phone Number 
     </label> 
     <input type="text" name="phone" placeholder="Enter your Phone Number" /><div><span id='errorphone'></span></div> 



     <input type="submit" name="submit" value="Next Step"> 

    </form> 

페이지 : 1 페이지 registration.html 이하

제출 버튼을 누르면 표시되는 것은 "You have successfully registered!"입니다. 데이터가 표시되지 않는 이유는 누구에게 말해 줄 수 있습니까?

페이지에서
+0

변경이되었고, 그래도 코드가 세 번째 페이지에 정보를 표시하는 작동하지 않습니다. 다른 제안을? – John

답변

0

2 <?php echo $_POST['username']; ?><?php echo $username; ?>에서 숨겨진 가치 변화와 그것을 당신은 나머지에 $ _POST 다음 줄에 [ "이름"]와 존중 필드를 추가 할 필요가

<input type="hidden" name="username" value="<?php echo $_POST['username']; ?>"> 
<input type="hidden" name="password" value="<?php echo $_POST['pwd1']; ?>"> 
<input type="hidden" name="passwordVerify" value="<?php $_POST['pwd2']; ?>"> 
<input type="hidden" name="firstName" value="<?php echo $_POST['firstName']; ?>"> 
<input type="hidden" name="lastName" value="<?php echo $_POST['lastName']; ?>"> 
<input type="hidden" name="email" value="<?php echo $_POST['email']; ?>"> 
<input type="hidden" name="phone" value="<?php echo $_POST['phone']; ?>"> 
+0

나는 위의 변경을하고 여전히 "You have successfully registered!"라는 메시지 만 표시됩니다. – John

0

를 게시하려고 대신 의 "> 은 $ 이름 변수가 시간에 설정되어 있지 않습니다.

+0

변경 사항을 적용했지만 세 번째 페이지에도 정보가 올바르게 표시되지 않습니다. 데이터를 검색하지 않는 세 번째 페이지에서 오류가 발생할 수 있습니까? – John

+0

숨겨진 값이 두 번째 페이지에 설정되어 있는지 확인 했습니까? –

+0

두 번째 페이지의 양식 앞에 "<"가 없습니다. 게시물에 대한 잘못된 선택 이었습니까, 아니면 파일에있는 것과 같은 것입니까? –