PDA

View Full Version : From Flash to PHP? Not working!


spacerom
06-26-2005, 09:59 PM
Hello to all!

I have a problem with a transfer from variables from action script to php and then to a databank...
I used this code on a button in flash:


on (release) {
if (!Personal_Nr.length) {
Kontakt_Status = "Bitte give your PnR!";
} else if (!Name.length) {
Kontakt_Status = "Please give your name!";
} else if (!Secondname.length) {
Kontakt_Status = "Please give you second name!";
} else {
container_send = new LoadVars();
container_send.Var1 = Personal_Nr;
container_send.Var2 = SummeRight;
container_send.Var3 = Name;
container_send.Var4 = Second Name;
container_send.Var5 = Points;
unescape(container_send);
container_send.sendAndLoad("DatabankLoad.php", container_send, "POST");
gotoAndStop("End");
}
}


It should be working but it does not....

In PHP however i use this script (I should i have PHP 5.0.2 in my Apache Server installed):

$Var1 = $HTTP_POST_VARS['Var1'];
$Var2 = $HTTP_POST_VARS['Var2'];
$Var3 = $HTTP_POST_VARS['Var3'];
$Var4 = $HTTP_POST_VARS['Var4'];
$Var5 = $HTTP_POST_VARS['Var5'];

$conn_id = mysql_connect("localhost","root","");
$db_con = mysql_select_db("Netzwerk_Quiz",$conn_id);


IF($conn_id){echo "Connection ok!"."<BR><BR>";}
else
{ echo "No connection"."<BR><BR>";}

IF($db_con){echo "Databank is chosen"."<BR>";}
else {echo "Cant find databank"."<BR>";}

echo "<BR>";
echo "----------------------------------------------------------------------------------------";
echo "<BR><BR>";

$daten_hinlegen = "INSERT INTO Results_from_Quiz
VALUES('".$Var1."','".$Var2."','".$Var3."','".$Var4."','".$Var5."')";


$ergebnis = mysql_query($data_save);


IF($ergebnis){echo "New data saved in databank"."<BR><BR>";}
else
{ echo "Canot save data"."<BR><BR>";}

?>

It cannot working although the php and mysql are ok...The problem i can not laod the variables from Flash to the php document....

Can anyone help?

spacerom

beanSoldier
06-27-2005, 03:03 AM
it might be this DatabankLoad.php.

do you know that the script is running.

make sure that path is correct.

spacerom
06-27-2005, 01:04 PM
The skript and the path on Databankload.php are correct! This is the php document in which the variables from flash must be loaded... I have allready try the php skript in my server and it's ok...The variables from flash can not be loaded i guess, **** can anyone say which is the way in PHP 5 to load variables with POST ?? Or has someone any opinion on that problematic?

spacerom
06-29-2005, 12:32 AM
It can not believe it, i have just try it a normal html form and the php script works...can anyone suggest a way to load variables from flash to php??
thanks

Flash Gordon
06-29-2005, 02:30 AM
Are Personal_Nr; SummeRight; etc, variables? or names of text fields?

spacerom
06-29-2005, 08:29 AM
They are names of text fields.
Why? Is that important?

Xman51
06-29-2005, 02:54 PM
Try:

container_send.Var1 = Personal_Nr.text;
container_send.Var2 = SummeRight.text;
container_send.Var3 = Name.text;
container_send.Var4 = Second Name.text;
container_send.Var5 = Points.text;L8er,

Xman51

spacerom
06-29-2005, 08:58 PM
well yes l have try that....
sorry, on my previous message i ment not that these variables are instances of textfields, they are variables with reference in textfields (like normal variables)....

Though, with instances too (like the way you shown), its working not... :(