-
Flash/PHP
Hi all,
Just wondering if anyone can help me with the following issue:
I have a contact form in .flash and I'm using PHP to make it live;
Code:
on(release) {
if (your name eq "" or your email eq "" or message eq "") {
stop();
} else {
loadVariablesNum("form.php", 0, "POST");
gotoAndStop(2);
}
}
I have created my form.php file:
PHP Code:
<?
$destination="[email protected]";
$name=$_POST['name'];
$email=$_POST['email'];
$mes=$_POST['comments'];
$subject="Message from $name" ;
$mes="Name : $name\n
Email: $email\n
Comments: $mes\n";
mail($destination,$subject,$mes); ?>
And I'm now calling this function through the following ActionScript:
Code:
on(rollOver) {
this.gotoAndPlay("s1");
}
on(rollOut, releaseOutside) {
this.gotoAndPlay(_totalframes - _currentframe);
}
on(release) {
if (your name eq "" or your email eq "" or message eq "") {
stop();
} else {
loadVariablesNum("form.php", 0, "POST");
gotoAndStop(2);
}
}
However the button doesn't appear to be active. I have checked my variables, server has PHP and I'm left wondering what else! Could anyone provide assistance.
Much appreciated.
Olly
-
Re: Flash/PHP
Is that ActionScript code? It's certainly not PHP.
-
Re: Flash/PHP
Yes, sorry I forgot to add my PHP code:
PHP Code:
<?
$destination="[email protected]";
$name=$_POST['name'];
$email=$_POST['email'];
$mes=$_POST['comments'];
$subject="Message from $name" ;
$mes="Name : $name\n
Email: $email\n
Comments: $mes\n";
mail($destination,$subject,$mes); ?>
Code:
<?
NOW ADDED TO THE ABOVE EXAMPLE
?>
-
Re: Flash/PHP
when you run that script alone, does it send the email? if not, then you might not have an smtp server installed that PHP can use to send the email.
other than that, I've no experience with using actionscript -- so I'm afraid I can't be of much help other than the basics. from looking over what you have, it seems simple enough to grasp. let me know if the script works on its own or not.