PHPsu
MANUAL ZH  |  EN
     


Current Position :| index>Beginners> Integrating Flash file in PHP document

Integrating Flash file in PHP document

FROM: AUTHOR: TIME:2008-06-06 HITS:
This is a lesson that will show you how to transform variables from Flash clip to PHP script.

Settings of the Flash player
Make an Input Box with the Text tool. You have to give a name for the impute box in the text properties pannel. You can choose the name by yourself but you have to remember it because you will use it in the PHP script.

I made 3 Input boxes. I named them "name","age",and "eye". I guess they are easy enough to be remembered?
Ok now you will need a button to open the PHP page. To open a new page in Flash use the action script and especially the variables getURL().This is the code: 
submit.onPress = function () {
http://www.phpsu.com

      
getURL ("getVars.php""_blank""POST");
}
Interpret the code:
1. getVars.php is the name of the PHP file witch you are going to use;
2. _blank makes the butting which is opening the page;
3. POST is the method in which to transfer the variables. The other option is GET.

The PHP code:

<? www.phpsu.com
// Receiving the variables.
$name $_POST['name'];
$age $_POST['age'];
$eye $_POST['eye'];

// Printing out the variables.

phpsu


print "Your name is "$name ".";
print 
"You are "$age ." years old.";
print 
"You have "$eye ." eyes."; phpsu
?>

Interpret the code:

The first three lines receive the variables from the scripting using $_POST[];
This is necessary because the more recent versions of PHP have global variables turned off by default.
On some hosts, your script will not work without using this method. You can name the variable whatever you
Like on the left of the equal sign ("="), but on the right, you must put the variable of your input text box.
TITLE:Integrating Flash file in PHP document
Copyright 2008 The PHPsu All rights reserved. This mirror generously provided by: .Hp Inc.
Last updated: Fri Jun 6 22:59:20 GMT-8 2008