-
PHP...i don't get it!
i can't figure out how to write that "post.php"
i've made a trace to check if vars were send and yes, those are send. but now how can i get back those values within PHP ?
i've read many things ( stickies from musicman etc...) but... i don't gettit .... could someone help me on that?
on (release) {
myvars = new LoadVars();
myvars.titre = _level0.titrenew;
myvars.texte = _level0.textenew;
//
myvars.send("post.php", 0);
//
}
thx in advance
-
Senior Member
try,
Code:
on (release) {
myVars = new LoadVars();
myVars.titre = _level0.titrenew;
myVars.texte = _level0.textenew;
myVars.send("http://www.yourserver.com/post.php", "_blank", "POST");
}
this should open a new browser window containing the page post.php
a simple script to test if the variables are arriving as expected could be,
PHP Code:
<?php
while (list($index, $value) = each($_POST)) {
echo "<p>$index ---- $value</p>";
}
?>
in your post.php script. this should write out the variables that are recieved.
-
Ok perfect !
thanks a lot... now the last question; how to avoid the "open window" and just give the var to the php file?
-
Senior Member
you could use sendAndLoad, this allows you to send variables to the PHP script and get a response (maybe just to say the script ran okay) back to flash,
Code:
myVarsSend = new LoadVars();
myVarsLoad = new LoadVars();
myVarsSend.titre = _level0.titrenew;
myVarsSend.texte = _level0.textenew;
myVarsLoad.onLoad = function() {
// got a response from PHP
}
myVarsSend.sendAndLoad("http://www.yourserver.com/post.php", myVarsLoad, "POST");
any output from the PHP script, the stuff echoed to the page in the form of a string of urlencoded variables,
eg
echo "&output=okay&";
will be returned to the myVarsLoad object, the onLoad event triggers when the loading has finished.
-
millions of thank you!
you made 2 people happy ... me & my client
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
|