PHP calling a variable question?

Ninja Smiley

New member
I am doing a simple ticketing system and i have a view cart page where the number of tickets and the total price is displayed.
On the checkout page where the information above is submitted to the database...
how do i call the variable that has the added price of the tickets onto that page?
 
You can save the older value into a session variable.

so, at the start of the other page,
add

session_start();


Then save the total value into the session array.

$_SESSION['price'] = $addedprice;

And, on the second page, you can call the variable like so

again, we need to start the session at the start of the page
session_start();

then, we can get the data from the session array

$Price = $_SESSION['price'];


You could, use $_GET if, you have the data in the URL, but people might change the value on the top and it would be wrong when you get it on the second page.

I hope this helps you out.
 
Back
Top