March 9, 200917 yr i hope someone can help me out here im looking to pass a variable from one page to another then onto another, i can send a variably from a form to another page but how do i send it onto the next page and then a page after that?? i dont want to put the variably in the address line as this would allow users to change this mid flow giving false answers etc. basically i want user to tick a box, then click a book now button. This then takes the info from the ticked section to another page where they enter their name etc then to another page to confirm and pay either via papal or googlecheckout, i goign to use the paypal easy buttons etc and just bring in the price to the button etc so need to pass the price from first section to the last payment page then send confirmation emails.
March 9, 200917 yr yeah php but never used sessions, cookies or hidden form fields before Well since you are using php i would reccomend using sessions, a very simple guide to this: At the start of your php file/s that will have the variable passed, put the following statement at the very top, directly after the <?php tag on a new line. session_start(); Now you can set variables to be stored in the session. Setting a session variable is done liek this: $_SESSION['name'] = $var name is anything you want it to be, name it somthing that will help you remember what the variable is used for. $var is the variable you want to pass. To call the variable simply echo the session var: echo $_SESSION['name']; $_SESSION['name'] will hold the variable through as many pages as you want providing the page has session_start(); at the very beggining. To destroy the var and the session put this at the bottom of your final page: session_destroy();
March 10, 200917 yr Author sounds good and simple, just like using the the get and request for forms and contact sheets just session stores the info. How does it store it??? cookies files or on the server??
April 8, 200917 yr Author how can i echo out the session varible within html?? echo "<p>name" .$_SESSION['name']; "</p>"; Edited February 2, 201016 yr by Sam G added [code] tags
Create an account or sign in to comment