Problem with WAMP; SWF and PHP
Posted by: vidoman (---.dyn.embarqhsd.net)
Date: March 10, 2007 06:22PM

I've managed to install and successfully use WAMP, and have been going through Stephen's (Killersites.com) great tutorials on PHP. Here comes my problem.

I have Swishmax, (flash authoring) which can interact with PHP. When I test a "movie" that has script that passes a variable to PHP, then PHP is to act on the variable and pass some text back into the SWF as another variable. I thought it was Swishmax or the SWF, however when I upload the file to my host, it works as expected.

Example:

This is the actionscript inside the SWF file.
on(press) {
this.loadVariables("script002.php",'POST');
}


The file has a dynamic input text field, with the variable myVar. It also has a dynamic text field with the variable myVar2. As the script states, on press (button action) it is to load the variables from the script002.php file.

The script inside the script002.php file:
<?php
//we have recieved variable myVar as php variable $myVar
//now we will send back the myVar2 containing data of my myVar we recieved.

echo "&myVar2=Hello $myVar from PHP&";

?>



Basically you type your name into the input text box (myVar) press the button to send. PHP then takes the myVar and returns the string "Hello John (or whatever name you use) from PHP" into the text field myVar2 within the SWF.

The problem is on my localhost (WAMP) it is not returning the value of myVar. All that it get is either "Hello from PHP" or Hello $myVar from PHP". Since it works when I upload it to my host, there is no problem with the scripts or SWF. It's with my WAMP localhost. I just used the default install, and did add 1 database for a phpbb forum I'm modifying. Other then that it is just a default install of WAMP.

Any ideas on what I need to do so that this will work on my localhost? Oh and yes all files are placed in my "root doc", www folder.

Thank you..smiling smiley


Options: ReplyQuote
Re: Problem with WAMP; SWF and PHP
Posted by: CyberSpatium (71.237.217.---)
Date: March 10, 2007 06:43PM

this is a register globals issue. your host has an older version of php installed. odver versions of php had register globals enabled by default in the php.ini file. but, starting with php 4.2, they where disabled for security concerns.

to work with wamp and php5, when dealing with post data, you will need to use the $_POST super global.

so, for example in your script, change
$myVar

to
$_POST['myVar']


[www.php.net]


CyberSpatium
----------------------
WAMP English Forum Admin

Options: ReplyQuote
Re: Problem with WAMP; SWF and PHP
Posted by: vidoman (---.dyn.embarqhsd.net)
Date: March 10, 2007 07:29PM

Hi Cyber,

Thanks that was the problem.. However it would not work with the myVar placed inside of quotes. Removing the quotes, and using the SuperGlobal $_POST works...

Been awhile since I've worked with this stuff,

Thanks again..

Options: ReplyQuote


Sorry, only registered users may post in this forum.