This is a fairly simple technique that uses a simple setup that will send variables from a Flash movie to a PHP script, and then that PHP script will print the variables out.
First you need to set up the input boxes. Create an input box by using the Text tool. In the text properties box, you must give the input box a name. It doesn't matter what the name is, but you must remember that name because we are going to be using it in the PHP script in a few minutes.
In my file I made three input boxes. I named them name, age, and eye. Simple enough, right? Now we have to make the button open up the PHP page. To open up a new page from Flash, we use getURL(). The code that I used looks like this:
submit.onPress = function () {
getURL("getVars.php", "_blank", "POST");
};
Here is what each argument does:
getVars.php is the name of the PHP file that is our target._blank makes the button open up a new page.POST is the method used to transfer the variables. The other option is GET.The PHP code is simple:
<?php
// Receiving the variables.
$name = $_POST['name'];
$age = $_POST['age'];
$eye = $_POST['eye'];
// Printing out the variables.
print "Your name is " . $name . ".";
print "You are " . $age . " years old.";
print "You have " . $eye . " eyes.";
?>
Now a quick explanation of the code.
The first three lines receive the variables from the scripting using $_POST[]. This is necessary because 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.
The second three lines print out the strings. The extra periods in there are used to connect the strings together. This is called the concatenation operator.
Just a final word before we wrap up. What you've seen here is freshly baked content without added preservatives, artificial intelligence, ads, and algorithm-driven doodads. A huge thank you to all of you who buy kirupa's books, became a paid subscriber, watch the videos, and/or interact on the forums.
Your support keeps this site going!
Cheers,
Jubs
:: Copyright KIRUPA 2026 //--