View Full Version : sending variables from Flash to php - wont work for some reason!
pcurrid
April 12th, 2006, 07:32 PM
Hi,
for some reason, I cant get my variables in Flash8 sent to a php file.
I have a local server set up on my PC, so maybe its a security issue???
I tried using getURL and it seemed to send as I could see the variables in the url but I could not echo them in the php file.
Now I'm trying the loadVariablesNum method
I have the following variables attached to input boxes:
name_var, age_var, address_var
I also have a button called submit_btn
and the very simple piece of actionscript:
submit_btn.onPress = function () {
loadVariablesNum("pleasework.php",0,"POST");
}
here is the relevant code on the pleasework.php
<?php
$age = $_POST['name_var'];
$name = $_POST['age_var'];
$address = $_POST['address_var'];
echo $age;
echo $name;
echo $address;
echo $test;
?>
Liger
April 13th, 2006, 03:12 AM
Use $_GET instead of $_POST
Hi,
for some reason, I cant get my variables in Flash8 sent to a php file.
I have a local server set up on my PC, so maybe its a security issue???
I tried using getURL and it seemed to send as I could see the variables in the url but I could not echo them in the php file.
Now I'm trying the loadVariablesNum method
I have the following variables attached to input boxes:
name_var, age_var, address_var
I also have a button called submit_btn
and the very simple piece of actionscript:
submit_btn.onPress = function () {
loadVariablesNum("pleasework.php",0,"POST");
}
here is the relevant code on the pleasework.php
<?php
$age = $_POST['name_var'];
$name = $_POST['age_var'];
$address = $_POST['address_var'];
echo $age;
echo $name;
echo $address;
echo $test;
?>
pcurrid
April 13th, 2006, 06:32 AM
tried that too,
and got nothing....very strange
lolomedia
April 13th, 2006, 09:41 AM
well, how do you have assigned your variables to load?
example:?
ActionScript Code:
submit_btn.onPress = function (){
age_var = age.text;
name_var = name.text;
address_var = address.text;
loadVariables("radio3.php",this,"POST");
i didn't see below you assigned your variables... how do you have them assigned? :pir:
JoshuaJonah
April 13th, 2006, 09:46 AM
try this instead:
submit_btn.onPress = function () {
var please:LoadVars = new LoadVars();
please.name_var;
please.age_var;
please.address_var;
please.sendAndLoad("pleasework.php",0,"POST");
}
<?php
$age = $_POST['name_var'];
$name = $_POST['age_var'];
$address = $_POST['address_var'];
echo $age;
echo $name;
echo $address;
?>
pcurrid
April 13th, 2006, 12:47 PM
I tried the sendAndLoad method,
but am still getting nothing when I go to view the php view in my browser.
all files are stored on the same location on my local apache server (http://localhost) (http://localhost%29). I tried using both the swf and the html containing the swf but still got nothing. Would it have anything to do with the way I am publishing the swf?
Thanks for the help by the way!
pcurrid
April 13th, 2006, 02:04 PM
think I have managed to get it working.
register_globals was set to On in my php.ini file.
also, I was only entering text through the swf file on its own,
as opposed to the html file that contained the embedded swf file,
it seemed to work when I did the latter, I dont know if thats expected or not?!
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.