Jump to content

passing form variables


Recommended Posts

Hi all, I created a registration, login page etc but then I realized I dont want to insert the data until after the payment is processed.
So I was trying to create the following,
Pick membership type- that gets pulled over to the registration page (I did that via url)
and then I would like to pass all the details in the registration page (name,username,etc) over to the payment processing page,
I was trying
<?php

$username=$_POST['username']
$firstname=$_POST['firstname']

?>

but it doesnt seem to be working. Anybody have any other ideas, Im new and trying to learn php, and dw at the same time. Thanks, Michelele
Link to comment
Share on other sites

[!--quoteo(post=351775:date=Mar 4 2006, 11:38 PM:name=Hooker)--][div class=\'quotetop\']QUOTE(Hooker @ Mar 4 2006, 11:38 PM) [snapback]351775[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Try:

[code]<?php

$username=$_POST['username'];
$firstname=$_POST['firstname'];

?>[/code]

for that part atleast
[/quote]

thanks, those breaks get me everytime, I dont know why I cant remember those,
So if I understand it right-
the above is creating a session for the entries someone puts in a form right? then in theory I could list their selections on the next page by doing something like,

<?php echo "Your almost done". $_SESSION['firstname'] ."!
br /><br />" ?>;
I appreciate the help, Im want to make sure Im understanding the process. Thanks, Michelle
Link to comment
Share on other sites

  • 2 weeks later...
[b]To make a session, which you can use the variables on various other pages follow these steps:[/b]

1.) At the very top of each page you want to either set or have the session variables availabe put the following code. Basically just put this at the top of all pages to be safe.

[code]
<?
     session_start();
?>
<html>
<body>...
[/code]

2.) To set variables in a session:

[code]
<?
      session_register("session_username");
      session_register("session_password");
      $session_username = $username;
      $session_password = $password;
?>
[/code]

3.) To use/get variables:

[code]
<?
     echo $_SESSION['session_username'];
     echo $_SESSION['session_password'];
?>
[/code]

4.) To delete all stored variables in the session:

[code]
<?
     session_unset();
?>
[/code]

[b] HOPE THIS HELPS SOME PEOPLE...[/b]
Link to comment
Share on other sites

[!--quoteo(post=351836:date=Mar 5 2006, 11:40 AM:name=plazman65)--][div class=\'quotetop\']QUOTE(plazman65 @ Mar 5 2006, 11:40 AM) [snapback]351836[/snapback][/div][div class=\'quotemain\'][!--quotec--]
thanks, those breaks get me everytime, I dont know why I cant remember those,
So if I understand it right-
the above is creating a session for the entries someone puts in a form right? then in theory I could list their selections on the next page by doing something like,

<?php echo "Your almost done". $_SESSION['firstname'] ."!
br /><br />" ?>;
I appreciate the help, Im want to make sure Im understanding the process. Thanks, Michelle
[/quote]


You Can Also try

[code]
<?php
$username=$_POST['username'];
$firstname=$_POST['firstname'];

//then have an hidden input here plus the rest of your form
echo "<form action='continue.php' method='POST'>
<input type='hidden' name='username' value='$username'>
<input type='hidden' name='firstname value='$firstname'>
//etc then your form below:
Please Select A Payment Method:
<input type='radio' name='paypal' value='paypal'>Paypal
//other payments etc
?>
[/code]

Then just keep the
[code]$username=$_POST['username'];
$firstname=$_POST['firstname'];
[/code]
along with the hidden inputs on each page.
doing so keeps the information going on and on through each page

This Worked For Me At Least
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.