Hi,
I think this may help you a little - you can use LoadVars
"sendAndLoad" function to send variables to a server script and get a
result back.
All the variables you send need to be "stored" in the LoadVars object
and sent. Any variables you return from the server need to be in the
form of
a query string - these variables will appear in the LoadVars object
you pass as the second parameter to the sendAndLoad function.
Here is a simple example to help you - I have not compiled this, so
check it carefully if you copy and paste.
Hope this helps.
Glen
//actionscript.
class FormPoster {
//...
function formSubmitted() {
mLoadVars = new LoadVars();
mLoadVars.name = mNameText.text;
mLoadVars.age = mAgeText.text;
//Post the form - you can use the delegate
mLoadVars.onLoad = Delegate.create(this, success);
mLoadVars.sendAndLoad("http://url.com/myscript.php", mLoadVars, "POST");
}
function(success:Boolean) {
if(false == success) {
//Handle Error
trace("there was an error with the sendAndLoad function");
} else {
//Handle success
if("err" == mLoadVars.result) {
trace("there was an error with the PHP");
} else {
trace("the PHP worked fine");
}
}
}
} //end of FormPoster
//PHP
<?php
//Any variables posted from your Flash form - sendAndLoad method
will appear in the $_POST array
$name = isset($_POST['name']) ? $_POST['name'] : NULL;
$age = isset($_POST['age']) ? $_POST['age'] : NULL;
//Call a function to do something with your variables - this is just
an example...
$success = doSomethingWithVariables($name, $age);
//This sends back a simple response to flash - you can send lots of
variables echo "var1=1&var2=two&var3=somethingelse"
echo "result=" .(TRUE == $success) ? "okay" : "err";
?>
Laurent CUCHET wrote:
I got a form in my movie with 2 questions :
Name and AGE
How can I do to create a txt with these 2 vars and make it downlable ??
(with PHP)
Than you very much
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com