Page 1 of 1

display chosen option onto another webpage

Posted: Thu Oct 16, 2008 1:48 pm
by ma5ect
hi all, i have a form with few options. what i am trying to do is display the option chosen from the user onto another page..i have the form setup up but what do i code to display the chosen option on the second page??

Re: display chosen option onto another webpage

Posted: Thu Oct 16, 2008 2:16 pm
by aceconcepts
Let's see your form.

This is how you get POSTED form elements:

Code: Select all

 
if(isset($_POST['submit']))
{
$firstName=$_POST['firstName'];
}
 

Re: display chosen option onto another webpage

Posted: Thu Oct 16, 2008 3:10 pm
by ma5ect
this is the 1st page..this works

Code: Select all

<form method="post" action="nextPage.php">
 
  <p align="center">
  <input type="text" name="txtInput" size="20" />
  <input type="submit" name="btnSubmit" value="Submit Data" />
  </p>
  <p align="center">&nbsp;</p>
  <div align="center">
    <table width="200">
      <tr>
        <td><label>
          <div align="center">
            <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_0" />
          Radio</div>
        </label></td>
      </tr>
      <tr>
        <td><label>
          <div align="center">
            <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_1" />
          Radio</div>
        </label></td>
      </tr>
      <tr>
        <td><label>
          <div align="center">
            <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_2" />
          Radio</div>
        </label></td>
      </tr>
      <tr>
        <td><label>
          <div align="center">
            <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_3" />
          Radio</div>
        </label></td>
      </tr>
    </table>
  </div>
  <p align="center"><br />
      </p>
</form>
 
  
 
2nd page...cant get the options to display

Code: Select all

<?php
 
if ( isset($_POST['btnSubmit']) ){
 
   if ( !empty($_POST['txtInput']) ){
      $strInfo = $_POST['txtInput'];
   }else{
      $strInfo = "You didn't submit any data in the form field.";
   
 $_POST['RadioGroup1_0'];
 $_POST['RadioGroup2_1'];
 $_POST['RadioGroup3_2'];
 $_POST['RadioGroup4_3'];
 }
echo htmlentities($strInfo, ENT_QUOTES);
 
}
 

Re: display chosen option onto another webpage

Posted: Thu Oct 16, 2008 6:37 pm
by allanre
Hi, name of your radiobuttons is RadioGroup1.
To echo it:
echo $_POST['RadioGroup1'];