variables to html form?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
BarryS
Forum Newbie
Posts: 9
Joined: Fri Oct 18, 2002 4:13 am
Location: London

variables to html form?

Post by BarryS »

I need help on how to get the php variables from my shopping cart. I need to get the variables cartid and value into the html form before submitting.

The html is:
<input type="hidden" name="cartId" value="Merchant Test">
<input type="hidden" name="amount" value="10.00">
<input type="submit" value="Secure Online Payment">

Is there another way in html and how do I send the same info without a "submit" keystroke.

Any help would be appreciated.
adcworks
Forum Newbie
Posts: 4
Joined: Fri Oct 18, 2002 3:35 am

Post by adcworks »

well presumably you would do something like

<input type="hidden" name="cartId" value="<?php print($cartid); ?>">
<input type="hidden" name="amount" value="<?php print($value); ?>">
<input type="submit" value="Secure Online Payment">

you would need the variables available from somewhere .. maybe your session, depends how your cart works.
User avatar
Zeceer
Forum Contributor
Posts: 136
Joined: Fri Aug 02, 2002 5:10 am
Location: Norway

Post by Zeceer »

Or you can use the echo function:
<input type="hidden" name="cartId" value="<?=$yourvariable?>">
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

note: for <?= $var ?> syntax you have to enable short_open_tag

a form element has a submit()-method that you can call i.e. from javascript.
Post Reply