Jump to content

Archived

This topic is now archived and is closed to further replies.

Plazman65

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

Share this post


Link to post
Share on other sites
Try:

[code]<?php

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

?>[/code]

for that part atleast

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
No - its not creating a session (I don't think).

All I see it doing is retreiving the values from a form - you'd have to register a session to use sessions...

Share this post


Link to post
Share on other sites
[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]

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

×

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.