Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 12-12-2004, 11:32 PM   #1
Nomadgita
Registered User
 
Join Date: Dec 2004
Posts: 6
Default sending variables from flash to php script?

Help! im trying to send some variables from an swf to a simple php script and then send them back. Currently im using an input field called input....and an output field called output (good naming!) in flash.....u type in a word in the input field and click send button which does this =

on (release) {
loadVariablesNum("http://MYDOMAIN/phpinfo.php", 0, "GET");

}

the php looks like this =

<?php

//THIS JUST ADDS SOME TEXT TO THE VARIABLE

$input.=" from php"

//THIS CREATES THE VARIABLE TO BE DISPLAYED IN THE DYNAMIC TXT FIELD CALLED OUTPUT BACK

IN FLASH

$output= "output=$input";
echo $output;

?>



It doesnt seem to work...cant anyone see where im going wrong?

thanks
Nomadgita is offline   Reply With Quote
Old 12-13-2004, 12:03 AM   #2
petefs
Fried Onions
 
petefs's Avatar
 
Join Date: Apr 2004
Location: Chicago, IL
Posts: 1,328
Send a message via AIM to petefs Send a message via MSN to petefs Send a message via Yahoo to petefs
Default

First, you're going to get a parse error from the missing semicolon after this line:
PHP Code:
$input .= " from php" 
Second, you must define a string variable before using the concat assignment operator like that.

Third, you should use the $_GET superglobal to retrieve variables sent through GET.
PHP Code:
$input $_GET['input'];
$input .= " from php";
$output "output=$input";
echo 
$output
Should work, then : )
petefs is offline   Reply With Quote
Old 12-13-2004, 02:49 AM   #3
Gibberish
WHAT!?
 
Join Date: Aug 2004
Location: San Diego, CA
Posts: 1,774
Default

flash code:
PHP Code:
on (release){
varsToSend = new LoadVars();
varsToSend.myPHPVar1 myFlashVar1;
varsToSend.myPHPVar2 myFlashVar2;
varsToSend.sendAndLoad("http://MYDOMAIN/phpinfo.php"varsToSend,"POST");

php code:
PHP Code:
echo $myPHPVar1;
echo 
$myPHPVar2
Gibberish is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:19 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.