PDA

View Full Version : Hidden Flash MX Variables to CGI


sproinkers
01-02-2010, 06:59 PM
I am trying to get flash to communicate with the cgi scripts associated with my shopping cart.

Here is the html code from one of my shopping cart pages that does work:
<input name="cart" type="HIDDEN" id="cart" value="Product^160^25^^">

Here is the code for the variable in Flash MX I'm trying parellel with the html code, but with no success:
set (cart, "Product^170^25^^");

Here is the posting code I'm using with a button win Flash MX:
on (release) {
getURL("http://www.mysite.com/cgi-bin/cart.cgi", 0, "POST");
}

I think the problem may be that Flash does not know how to communicate that it is a "hidden input field", but I'm not positive. I just know that it's not adding "Product" to the shopping cart.
Please help me troubleshoot:)

sparkdemon
01-02-2010, 08:19 PM
HTML hidden type only means that its a control thats not visible at client end. so it cannot be visually rendered by browser.

If you use flash. simple keep a variable on main timeline as :

pid = "Product^170^25^^";

then your code:

on (release) {
getURL("http://www.mysite.com/cgi-bin/cart.cgi", 0, "POST");
}

will work just great. because you are posting all variables off the level 0 so your variable pid should be on the root timeline.

sproinkers
01-04-2010, 03:44 PM
Thanks SparkDemon,
What code would I use if I have to communicate "cart" as the hidden inpiut name?
pid = "Product^170^25^^";

sparkdemon
01-06-2010, 02:36 AM
var cart = "Product^170^25^^";

then : getURL("http://www.mysite.com/cgi-bin/cart.cgi", 0, "POST");

[ the simplest way ]

$cart = $_Request['cart']; // php example