Page 1 of 1

passing variables

Posted: Tue Nov 11, 2003 11:40 am
by username10
Please help.

I have a quote form (javascript and php). When the user submit the information, they are returned a calculated quote.

If the user agrees, they would then click a purchase button.

I need to carry that quote on to "2checkout" (a shopping cart), and am lost on the approach.

Please help.


Al

Posted: Tue Nov 11, 2003 12:08 pm
by Johnm
Assuming (which is a dangerous thing) that the user would be able to continue to shop you may want to consider storing their order in a database table. That way you could go and get it/them when you need to.
John M

Posted: Tue Nov 11, 2003 12:22 pm
by username10
like your sig,

.....

The does sound like the most ideal However, not in a position to do it. Is it possible to just retain the quote variable & value from the first form and place it in a new form on the parsed php file.

Posted: Tue Nov 11, 2003 12:29 pm
by Johnm
Are you using sessions? If so, set it as a session var and you will have it any page through out the session. If not, set a var equal to the POST (or get depending on which you use) var.

John M

P.S. You like the steel-your-face huh, LOL. Most people on this forum have no idea what it means. But that is okay I guess... more music for me!

Posted: Tue Nov 11, 2003 12:41 pm
by username10
I'll read up on setting a variable to post.



......GD logo
http://charmcreations.com/Products/inde ... l/2965.htm

Posted: Tue Nov 11, 2003 12:45 pm
by Johnm
If you are using the POST method then it is already there on the second page so on the second page set the var to the POST value. Sessions would be worth looking into.

Code: Select all

<?php
$var = $_POST['varName']
?>

John M

Posted: Tue Nov 11, 2003 1:01 pm
by vigge89
Johnm wrote:If you are using the POST method then it is already there on the second page so on the second page set the var to the POST value. Sessions would be worth looking into.

Code: Select all

<?php
var = $_POST['varName']
?>

John M
You mean

Code: Select all

<?php
$var = $_POST['varName']
?>
, right?
?>

Posted: Tue Nov 11, 2003 1:14 pm
by Johnm
Uhhh.... What do you mean?

[ John quickly makes use of his powers as a moderator to go and change his post to reflect the correct syntax]


It is right... Now

LOL
I have been writing VB for the last two weeks... Sorry.


John M

Posted: Tue Nov 11, 2003 1:17 pm
by mrvanjohnson
There is a PHP Shopping cart tutorial that might help you

http://www.macromedia.com/devnet/mx/dre ... _cart.html

Posted: Tue Nov 11, 2003 2:01 pm
by d3ad1ysp0rk
Johnm wrote:If you are using the POST method then it is already there on the second page so on the second page set the var to the POST value. Sessions would be worth looking into.

Code: Select all

<?php
$var = _POST['varName']
?>

John M
haha its still not right :D

Code: Select all

<?php
$var = $_POST['varName']
?>
:lol:

Posted: Tue Nov 11, 2003 2:03 pm
by Johnm
LOL... Yes it is... Look!

[John again takes his mod powers out of the box]
[Hahah... Must note that there is a preview function on this board ;) -- JAM]

See! LOL


Sorry About that. Too many programming languages running around in my head.

Posted: Tue Nov 11, 2003 9:41 pm
by username10
It's hard being new, but this is what I did. Yes , it's not right. need more help. I'm trying to get the totalcharge value into the total value of the new form.

<form method="post" action="..." name="form">
<?php
$total = $_POST['totalcharge']
?>

<p>Total Purchase
<input type="text" name="total" value=$total>
</p>
<p>
<input type="hidden" name="sid" value="123">
<input type="hidden" name="cart_order_id" value="quote">
<input type="hidden" name="demo" value="y">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>

Thanks

JR

Posted: Tue Nov 11, 2003 9:52 pm
by mrvanjohnson
You'll need to change this
<input type="text" name="total" value=$total>
to this
<input type="text" name="total" value="<?php echo $total ?>">
Then it should work

Posted: Tue Nov 11, 2003 10:33 pm
by username10
Thank you all, this worked perfectly. I will read up on sessions tonight.

Thanks again!