Jump to content


Photo

passing form variables


  • Please log in to reply
5 replies to this topic

#1 Plazman65

Plazman65
  • Members
  • PipPipPip
  • Advanced Member
  • 46 posts

Posted 05 March 2006 - 06:18 AM

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

#2 Hooker

Hooker
  • Members
  • PipPipPip
  • Advanced Member
  • 193 posts
  • LocationWales, UK

Posted 05 March 2006 - 07:38 AM

Try:

<?php

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

?>

for that part atleast

#3 Plazman65

Plazman65
  • Members
  • PipPipPip
  • Advanced Member
  • 46 posts

Posted 05 March 2006 - 04:40 PM

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

<?php

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

?>

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

#4 ale_jrb

ale_jrb
  • Members
  • PipPip
  • Member
  • 17 posts
  • LocationLondon, UK

Posted 05 March 2006 - 05:05 PM

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...

#5 JustinK101

JustinK101
  • Members
  • PipPipPip
  • Advanced Member
  • 503 posts
  • LocationSan Diego, California, US

Posted 20 March 2006 - 04:07 AM

To make a session, which you can use the variables on various other pages follow these steps:

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.

<?
     session_start();
?>
<html>
<body>...

2.) To set variables in a session:

<?
      session_register("session_username"); 
      session_register("session_password"); 
      $session_username = $username;
      $session_password = $password;
?>

3.) To use/get variables:

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

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

<?
     session_unset();
?>

HOPE THIS HELPS SOME PEOPLE...


#6 skatermike21988

skatermike21988
  • Members
  • PipPipPip
  • Advanced Member
  • 100 posts
  • LocationFlorida

Posted 20 March 2006 - 05:08 AM

[!--quoteo(post=351836:date=Mar 5 2006, 11:40 AM:name=plazman65)--][div class=\'quotetop\']QUOTE(plazman65 @ Mar 5 2006, 11:40 AM) View Post[/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

<?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
?>

Then just keep the
$username=$_POST['username'];
$firstname=$_POST['firstname'];
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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users