The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.
I doubt if there’s any reason why the Freeola server would reject the script, so I can only assume I’ve written it wrongly. With only three fields (Name, Company, Email) it should be fairly short and I’m wondering if anyone out there can give me a sample of the basic code. I’d very much appreciate some help.
Pleased it's working.
JTD
The PHP code that works for me is as follows:
$fn= $_REQUEST["fn"];
$sn= $_REQUEST["sn"];
$t= $_REQUEST["t"];
$c= $_REQUEST["c"];
$email= $_REQUEST["email"];
$to = "[email protected]";
$subject = "Motivational Speaking Enquiries";
$body = "Forename: $fnnSurname: $snnTelephone: $tnE-mail: $emailnComments $c";
mail($to, $subject, $body, 'From: [email protected]','-f [email protected]');
?>
However, because global variables are turned off – the information passed from the flash file to the php script wouldn’t work. Since PHP 5.0, apparently, these have been turned off by default to improve security. The normal way around this is to use GET or POST or HTTP POST to pull the variables from the array that’s holding them but this wouldn’t work with flash.
It seems that it needs a different command called REQUEST which is a combination of both GET and POST to work.
Once again, thanks to Jim and t1mmie for their help.
Right, good stuff so far, now you need to check what, if anything, is being passed to the form. I regulary use this script to work out what is being passed from the submitted form.
Create a page called processform.php and copy the below code into it. Then call processform.php from your submit action.
<?php
/* Script name: processform.php
* Description: Script displays all the information passed
* from a form.
*/
foreach ($_POST as $field => $value)
{
echo "P:$field = $value<br>";
}
foreach ($_GET as $field => $value)
{
echo "G:$field = $value<br>";
}
foreach ($_REQUEST as $field => $value)
{
echo "R:$field = $value<br>";
}
?>
It might shed some more light on the matter.
JTD
I'm pleased to report that things seem to be moving in the right direction. I can now send/receive the form. The only problem is that all the fields are blank. Trying to work out why.
> 2. The submit action in flash should therefore point to
> http://www.motivationalspeaking/htdocs/mail.php
What Jim said - so you'd need to use this instead:
http://www.motivationalspeaking/mail.php
But all files still stay in your htdocs folder.
You don't need the htdocs part of the path. htdocs is the root of your directory and therefore doesn't need to be included in the path after the domain.
You are correct about where the files are located though.
JTD
1. All files (html.swf and php) should be in the htdocs directory on the server.
2. The submit action in flash should therefore point to http://www.motivationalspeaking/htdocs/mail.php
Is that correct? Appreciate your help.
<?php
$fn=$_REQUEST["fn"];
$sn=$_REQUEST["sn"];
$t=$_REQUEST["t"];
$c=$_REQUEST["c"];
$email=$_REQUEST["email"];
$to="motivationalspeaking.co.uk";
$subject="Motivational Speaking Enquiries";
$body="
Forename: $fn
Surname: $sn
Telephone: $t
E-mail: $email
Comments: $c
";
$from="From: [email protected]"
if (mail($to, $subject, $body, $from)) {
echo "<p>Message sent!</p>";
} else {
echo "<p>Message failed!</p>";
}
?>
If that doesn't work, then your Flash your fields in Flash don't have the same name and ID.
Make sure that everything in Flash is named the same in every way possible, so make sure that the comment box is named 'c', for example.
If you replace your variables with hard code does it work then?
I often use this script to debug:
<script language="JavaScript" type="text/javascript">
alert("<?php echo $message;?>");
</script>
It pops up with a dialogue box showing your variable contents.
Place it before the mail() statement and replace my $message with your variables. My first guess would be that one or more variables is null - but this will soon identify that.
I also note you use $_GET - does Flash use $_GET or $_POST?
JTD
I know you said the code you're showing is stripped out - but don't you have to use the sendmail command ('/usr/sbin/sendmail') somewhere along the line?
Ignore me if I'm totally missing the point :¬)
Search Freeola Chat