-
Posting variables with PHP to a frame set
I'm trying to get my game variables to save to a php script - but I want the script to open to a hidden frame window. For some reason it wont open it to that frame with IE, and with Netscape its not transferrring all the variables over. I've been stuck on this for months, so if anyone can help me, Id REALLY appreciate it!
www.FreeFlashRPG.com/Angels/AngelGameDemo.html
-
Senior Member
Could be a netscape bug, have you tried with IE?
This is the wrong place for this question IMO, it has nothing to do with games. Not even to do with flash by the sounds, try a php forum.
www.php.org
fracture2 - the sequel
fracture - retro shooter
blog - games, design and the rest
"2D is a format, not a limitation" -Luis Barriga
-
-
Senior Member
-
Flash Developer on a break
Or you could use an iframe..
Code:
getURL("javascript:loadwindow('http://www.freeflashrpg.com/Angels/write_cFile.php?var1=value1&var2=value2')");
And in the html:
Code:
//in the HEAD:
<script>
function loadwindow(theURL){
iframe.location = theURL;
}
</script>
//somewhere on the page:
<IFRAME name="iframe" src="" width="1" height="1" scrolling=no border=no frameborder="0" marginwidth="0" marginheight="0" vspace="0" hspace="0">You'll need IE3.0+, N5+ or Opera4 to see this.</IFRAME>
Make a mental note that a javascript does NOT send flash GET and POST variables with it to the frame.
Jeroen
| "Keep Flashing!"-Jeroen
PHP multiplayer? Check this thread: PHPgateway
-
ʞ33ƃ
Dont you normally just use a loadvars or loadvariable with the things you want to send specified on the end of the url (get)?
Code:
on(release) {
loadVariables("coolguy.php?username=McNugget&password=whatahunk", "_root.loadTarget");
}
*Note for the example I used loadVariables, however I would strongly sugges using the loadVars object.
Nugget
*edit* Bah now that I read your subject you specified you wanted to use Post... um heres how you can use get
-
ʞ33ƃ
Here is what I think your looking for, and there is no need to use frames. You would use the loadVars object, and then use the sendandload so the page isnt redirected.
Starting Page
http://www.devshed.com/Client_Side/F...rms/page1.html
Page that I think your looking for
http://www.devshed.com/Client_Side/F...rms/page6.html
Nugget
-
Flash Developer on a break
McNugget.. you're right of course. I usually use the loadvars/POST manner.
He asked for a getURL version, and he got it. ^_^
macbird, in reply to your email/pm:
in the code after ....save_window.php?cFile=cFile'
it transfers cFiles value as 'cFile'
The text before the '=' is the variable name, and the text after the '=' is the value of that variable. Hope that that clarifies it a bit.
So a file adressed as in your example, "save_window.php?cFile=something"
The cFile variable can be called in PHP by '$cFile'.
Outputting the cFile variable on screen would be with the code: echo $cFile;
Hope that helps.
| "Keep Flashing!"-Jeroen
PHP multiplayer? Check this thread: PHPgateway
-
Thanks Jeroen, I appreciate this and I know what your saying, but..
When the script loads in the iFrame,
and I echo the variables $cFIle and $Account I get:
'cFile' and 'Account'
instead of the values their suppose to have. I don't know why its doing this...
heres my code one more time:
Code:
getURL("javascript:loadwindow('http://www.freeflashrpg.com/Angels/write_cFile.php?cFile=cFile&Account=Account')","");
I traced the variables in the movie right before sending them, so I know they have the right value..
-
Senior Member
Code:
getURL("javascript:loadwindow('http://www.freeflashrpg.com/Angels/write_cFile.php?cFile="+cFile+"&Account="+Account+"')","");
fracture2 - the sequel
fracture - retro shooter
blog - games, design and the rest
"2D is a format, not a limitation" -Luis Barriga
-
Flash Developer on a break
Well.. random answered that question. And here's a response on how to use loadvars as requested in your mail.
ActionScript:
loadVariablesNum("script.php", 0, "POST");
This loads AND sends all variables on the _root of the flash movie.
For example, in the _root might be 2 variables.
flashVar1 = 3;
and
flashVar2 = 6;
Now, use a button with that AS attached. The PHP file could for example be like this:
Code:
<?php
$phpVar1 = $flashVar1 * $flashVar2;
echo "&phpVar1=$phpVar1";
?>
Now, flash loads the string "&phpVar1=$phpVar1" into the _root. The flashplayer converts that string to variables and values. So if you would have a textfield on the root with 'phpVar1' as its variable, it would display '18'.(without the quotes)
Hope that helps.
Jeroen
| "Keep Flashing!"-Jeroen
PHP multiplayer? Check this thread: PHPgateway
-
-
Flash Developer on a break
Hehe.. no problem.
And you can always email me for stuff.
| "Keep Flashing!"-Jeroen
PHP multiplayer? Check this thread: PHPgateway
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|