PDA

View Full Version : converting vars to html input type hidden


vosgien
03-08-2004, 11:25 AM
Hi,
I am not at all sure how to do this as my html knowledge is pretty thin. I am trying to set up a payment processor link and have been provided with some html code but I cannot work out how to convert my flash vars.
My file voucher.php looks like this :

<php?/* bunch of code to pull in variables from Flash
and create a few other variables such as $date & $random number
this all works well, details from flash are then written to a text file*/
//close php
?>

/*here a html doc is created with code to load in images, set the scroll bar properties and display text for the user, again like the php above absolutely no probs with any of that...........
above code is followed by this............*/

<form action="http://somesite.com/payments/select" method="post">

<input type="hidden" name="store" value="[storename]">

<input type="hidden" name="cname" value="GBP">

<input type="hidden" name="max" value="2">

<input type="hidden" name="code1" value="EXMPL">

<input type="hidden" name="desc1" value="Gift Voucher
<input type="hidden" name="cur1" value="GBP">

<input type="hidden" name="cost1" value="25.99">

<input type="hidden" name="qty1" value="1">

<center><input type="submit" value="NEXT"></center><br><br>

.... when the next button is clicked the above values will be sent to somesite.com
</BODY>
</HTML>
[PHP]

I should add that I am using send so that voucher.php opens in a browser window.

So question is how do a convert my flash variables to the values above - I am only really interestd in "cost1" at this stage, this comes into the php from Flash as $amount
Do I for instance ( in the php part of code) have something like
[PHP]$cost1 = $amount or something similar ???

On testing that doesn't seem to work, if I use echo it prints the variables on the html page - which is not what I want.
Can I use echo in the hidden input - like this;
[PHP]<input type="hidden" name="cost1" value= <?php echo $amount?>[PHP]
That really does not look right ( or good).... or is it OK ?

Any help appreciated

Cheers

Vosgien

p.s can make my entire file available if anyone has the time to look Ta !

p.p.s. I have also done a very thorough search here and at devshed, but cannot find what I need

CyanBlue
03-08-2004, 11:37 AM
Yo... :)

I am not quite getting what you are asking... (and, my work here is sorta preventing me to understand it well... :()

This might be how you can call that HTML form in the Flash, and yes, I could be totally off of what you are asking... If I am, just disregard what I am writing here... :D

This is the script you will have to use to call the script with those variables...payment_lv = new LoadVars();
payment_lv.qty1 = 1;
payment_lv.cost1 = 25.99;
payment_lv.cur1 = "GBP";
payment_lv.desc1 = "Gift Voucher";
payment_lv.code1 = "EXMPL";
payment_lv.max = 2;
payment_lv.cname = "GBP";
payment_lv.store = "[storename]";
payment_lv.sendAndLoad("http://somesite.com/payments/select", payment_lv, "POST");

vosgien
03-08-2004, 11:59 AM
Hi Jason

Yep, I had kinda worked out that life could be easier if a I renamed my Flash vars, the question then is will the html code pick up those vars...... cos if it does I don't understand why.

sorry for the tagging, i just couldnt seem to get it to work ( or right ,) lol!!!

Cheers

Vosgien