display chosen option onto another webpage

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ma5ect
Forum Commoner
Posts: 35
Joined: Wed Jun 25, 2008 8:38 am

display chosen option onto another webpage

Post 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??
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: display chosen option onto another webpage

Post 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'];
}
 
ma5ect
Forum Commoner
Posts: 35
Joined: Wed Jun 25, 2008 8:38 am

Re: display chosen option onto another webpage

Post 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);
 
}
 
allanre
Forum Newbie
Posts: 9
Joined: Wed May 10, 2006 1:40 pm

Re: display chosen option onto another webpage

Post by allanre »

Hi, name of your radiobuttons is RadioGroup1.
To echo it:
echo $_POST['RadioGroup1'];
Post Reply