Jump to content

Archived

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

olsonsp4c

Passing Variables

Recommended Posts

could someone give me some input on how I might be able to do something?

 

This is an example only just to pose the situation...

 

Your customer is on the checkout_shipping.php page and clicks on a check box that passes the value 1 into the variable 'accept' in order to accept liability for shipping damage.

 

The customer then goes to checkout_payment.php to choose a payment method.

 

The customer then goes to checkout_confirmation.php

 

The issue is how to get to checkout_confirmation.php without LOSING the 'accept' variable value - how do you pass the variable on from page to page to page?

 

Thanks!

 

Scott

Share this post


Link to post
Share on other sites

Assign variables to the $_SESSION array like;

PHP Code:

$_SESSION['var'] = $val;

Make sure that you have started the session with session_start()

 

I think that will work

Share this post


Link to post
Share on other sites

so, would it be like this?

 

checkout_shipping.php

 

<td class="main" align="right" valign="middle"><input type="checkbox" name="accept_liability" value="1">Select this box to accept liability up to $500...</td>

 

value is stored in 'accept_liability'

 

checkout_payment.php

 

session_start();
$_SESSION['accept_liability'] = $accept_liability;

 

value is stored in $accept_liability

 

checkout_confirmation.php

 

$accept_liability = $_POST[$accept_liability];

 

thanks!

 

Scott

Share this post


Link to post
Share on other sites

×