Click to See Complete Forum and Search --> : Problem posting from flash to php
I made a swf that sends data to a PHP script to mail something. The problem is that the php script does not reseive the variables.
I don't think it's a problem with the code. I suspect a problem with the apache server.
Here is a example of the code:
Flash:
to = "vipkillerb@hotmail.com";
subject = "Test PHP";
message = "Body";
getURL ("postmail.php" , "/" , "Post");
PHP:
<?php
//Send to Variable
$MailTo = "tvangenechten@paratel.be";
//Send Mail
if( isset($to) &&
isset($subject) &&
isset($message) )
{
mail($to, $subject, $message);
}
?>
flipis
02-15-2002, 12:11 PM
Here is a example of the code:
Flash:
to = "vipkillerb@hotmail.com";
subject = "Test PHP";
message = "Body";
getURL ("postmail.php" , "/" , "Post");
>> Post is written as POST. In uppercase letters. Same for GET.
>> Are you sure the swf movie is in the same directory as the PHP script?
PHP:
<?php
//Send to Variable
$MailTo = "tvangenechten@paratel.be";
>> What does this variable really do? You don't use it in the code.
//<< COPY - PASTE >>
//Use this to debug:
echo $to."<BR>";
echo $subject."<BR>";
echo $message."<BR>";
//Send Mail
if( isset($to) &&
isset($subject) &&
isset($message) )
{
mail($to, $subject, $message);
}
?>
Hope it helps.
fLIPIS
gardner1
02-15-2002, 02:44 PM
was thinking along the same lines...
$MailTo = "tvangenechten@paratel.be";
// try not to mix case , use $mail_to or
$receivers_mail
mail($to, $subject, $message);
// should this not be instead:
mail($mail_to, $subject, $message);
or per the mail() documentation, you can do:
mail("tvangenechten@paratel.be", $subject, $message);
http://www.phpbuilder.com/manual/function.mail.php
Thank you for your help. But as I told you, I don't think it's a problem with the code.
I did try to write POST in uppuer case but that didn't change a thing.
the line:
$MailTo = "tvangenechten@paratel.be";
is not used any more, it was something dat got in while debugging.
At this moment my actual code looks like this:
<<<<<<< Start Code sample >>>>>>>
<?php
global $HTTP_POST_VARS;
echo "OK1|".$HTTP_POST_VARS['to']."|".$HTTP_POST_VARS['subject']."|".$HTTP_POST_VARS['message'];
echo "OK2|".$to."|".$subject."|".$message;
//Send Mail
if( isset($to) &&
isset($subject) &&
isset($message) )
{
mail($to, $subject, $message, "From: $MailFrom");
}
?>
<<<<<<< End Code sample >>>>>>>
When I send something using the flash I get:
OK1|||OK2|||
What means that the Variables are emptry.
The PHP in not in the same directory as the flash but in the real flash I use the complete path.
When using a GET everything works fine. But I have to much data to send.
PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved.