-
[F8] Send vars to PHP
I have the following in my F8 AS 2.0:
PHP Code:
getURL("email.php?sName=" + _root.form.contactName.text +
"&subject=" + _root.form.contactSubject.getSelectedItem().data +
"&email=" + _root.form.contactEmail.text +
"&message=" + _root.form.contactEmail.text,"_blank","POST");
and this in my php:
PHP Code:
$name = $_POST['sName'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message"'];
but when I echo teh variable names, I get noghing.
-
Because you are not sending POST data. POST data is sent along with a url, but NOT in the url itself. If the data is in the url itself, like you are sending here with flash, then you need to use GET to access them.
Replace $_POST with $_GET and try it.
-
try using sendAndLoad rather than getURL...this way you can set up your php to send a confirmation back to flash, and it won't open another window
-
-
Ok That worked, I have no changed it to:
PHP Code:
var sendData = new LoadVars();
var recieveData = new LoadVars();
sendData.subject = _root.form.contactSubject.getSelectedItem().data;
sendData.sName = _root.form.contactName.text;
sendData.email = _root.form.contactEmail.text;
sendData.messageText = _root.form.contactMessage.text;
sendData.sendAndLoad("email.php",recievedData,"POST");
how shoudl I code my php?
-
-
your php should be the same at the beginning to receive the vars from flash...just set up a mailTo() function in php and echo a variable that will be sent back to flash.
this is a good example: http://www.thegoldenmean.com/techniq...mailform1.html