How To Pass Variable From A Form To Next Page
Posted: Wed Mar 09, 2011 1:26 pm
Hey guys,
Hopefully someone could help me out with some basic php. I've been trying to figure it out all night but I'm out of ideas lol.
The way my site is set up is there's a landing page (page 1) that goes to the registration page (page 2), then on the registration page there's a form that the user enters their info like first name, last name, email etc and then when that form is completed I've been trying to get the form to pass the variables to the next page. The form's method is 'post'. Here's the form's code -
However the next page is a redirect link (page 3) & I'm trying to figure out how to pass the variables from the form into the redirect link, I've got the correct code for the variables and I don't think that's the issue, but I get the feeling I need to use POST or GET php methods. I can post the form data on to the page 3 by using -
and it shows the first name & email from page 2, but what I need to do is pass the variables in to the redirect code so I tried this -
But the data does not get passed by using $firstname and I've tried a bunch of different php but can't figure it out
Really appreciate anyone's help in advance!
Kev
Hopefully someone could help me out with some basic php. I've been trying to figure it out all night but I'm out of ideas lol.
The way my site is set up is there's a landing page (page 1) that goes to the registration page (page 2), then on the registration page there's a form that the user enters their info like first name, last name, email etc and then when that form is completed I've been trying to get the form to pass the variables to the next page. The form's method is 'post'. Here's the form's code -
Code: Select all
<form id="signupForm" name="signupForm" method="post" action="registration_submit.php">
<p>
<label for="firstname">First Name:</label>
<input id="firstname" name="firstname" class="required inputWidth" type="text">
</p>
<p>
<label for="lastname">Last Name:</label>
<input id="lastname" name="lastname" class="required inputWidth" type="text">
</p>
<p>
<label for="email">Email:</label>
<input name="email" id="email" class="required email inputWidth" type="text">
</p>
<p>
<input name="agree" value="no" type="hidden">
<input name="agree" value="yes" checked="checked" type="checkbox"> <span style="font-size: 10px;">Yes, I would like to receive new offers and information from TheConsumerWinner.com.</span> </p>
<p>
<input name="submit" id="submit" style="margin: 0pt 0pt 0pt 150px; padding: 7px; font: bold 12px Arial;" value="Register now!" type="submit">
</p>
</form>Code: Select all
<?php
$firstname = $_REQUEST['firstname'];
$lastname = $_REQUEST['lastname'];
$email = $_REQUEST['email'];
echo "Here is the first name: ". $firstname. ".<br />";
echo "Here is the email: ". $email.".<br />";
?>Code: Select all
<?php
$firstname = $_REQUEST['firstname'];
$lastname = $_REQUEST['lastname'];
$email = $_REQUEST['email'];
echo header( 'Location: http://mysite.com/test&fname=$firstname' ) ;
?>Really appreciate anyone's help in advance!
Kev