PDA

View Full Version : PHP Variables using $Get


High Camp
12-23-2006, 12:28 AM
Hi All
I have gone through the great tutorial Jesse wrote about passing variables around using php but I can't get it to actually work. I even downloaded the source file and uploaded it directly on to the server and that didn't work. I know for a fact that my server supports php because I use it to set cookies.

This is the pertinent code in my index.php file:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
width="100%" height="100%" id="index" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="index.swf?test=<?php echo $value; ?>" />
<param name="wmode" value="transparent" />
<param name="quality" value="high" />
<param name="scale" value="exactfit" />
<param name="bgcolor" value="#cccccc" />
<embed src="index.swf?test=<?php echo $value; ?>"
quality="high" scale="exactfit" bgcolor="#cccccc" width="100%" height="100%" wmode="transparent" name="index" align="middle" allowScriptAccess="sameDomain"
type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></embed>


This is just set up to test the theory. I have a text box in my flash movie with the base variable "test". I have also tried "_level0.test" with no luck.

My understanding is that with this setup I can type www.myserver.com/index.php?test=HelloWorld into the address bar and the text box should say "HelloWorld". Have I missed something? Am I doing something wrong?

Questions #2: A long time a go I came across a tutorial Jesse had written (I can't remember the subject) and he referenced using a variable to set the root folder so the flash is easily moved to different servers with minimum effort. Can someone point me to that tutorial again so I can use this for a different solution? I'm sure I could figure this one out by myself but it is faster and easier to read someone else’s thoughts on the subject.

I have done my best to search the tutorials and forum posts before posting. It really ticks me off personally when I see questions posted on forums that have already been answered 100 times.

Thanks very much for any help provided, it's much appreciated.

Update: When I open the swf directly with the variables it works. So when I type www.myserver.om/index.swf?test=HelloWorld the text box shows "HelloWorld".

Flash Gordon
12-23-2006, 01:15 AM
I remeber reading that a long time ago and if I recall correctly (since you didn't include your php code) his code assumes you have Global variables on.

hxxp://www.foo.com/index.php?page="mike"

echo $_GET['page'];

duncanhall
12-23-2006, 01:18 AM
I could be wrong, but try replacing your line:


<param name="movie" value="index.swf?test=<?php echo $value; ?>" />


with:


<param name="movie" value="index.swf?test=<?php echo $test; ?>" />

High Camp
12-23-2006, 06:02 PM
Hi Guys

Thanks so much for your help. I was reading over the script this morning and realized that in the past I have had to use $_POST so why wouldn't I have to use the same for GET. I was just about to look it up when I came here first to see if I had gotten any answers.

I also realized I hadn't changed the variable from value to test before copying and pasting it.

Thanks again and Happy Holidays,