PHP script for emailer

Hi all!

Can someone please give me a PHP script that I can use for my HTML and Flash forms?

I have made some form asking for the name, address, email, and comments from my website visitors. I have done this by using a free service from bravenet.

I would really appreciate some help. Help, please Anyone?

=)

comicGeek

Hi,

I had the same problems as you have at the moment with flash and php. Have you designed the form? Linked the fields to variable names etc?

The php code I used was:

<html>
<body>
<?php
$ToEmail = "[email protected]";

$ToSubject = “Enquiry”;

$BrowserType = $HTTP_USER_AGENT;

$MediaTypes = $HTTP_ACCEPT;

$ServerName= $REMOTE_ADDR;

$EmailBody = "Sent By: $FirstName
Senders Email: $Email

Message Sent:
$ToComments

$BrowserType
$MediaTypes
$ServerName";

mail($ToName." <".$ToEmail.">",$ToSubject, $EmailBody, “From: “.$FirstName.” <”.$Email.">");
?>
</body>
</html>

The method is as follows:

(If you need actionscript for the send button then let me know)

copy the php code to your mail server in the same folder as your html and swf files and call it mailPHP.php

before doing this however you need to change a few bits in the php code.

In the above code $email, $FirstName and $comments are all php variables passed values through flash, i.e. I have in my form three text boxes, with the variable names email,FirstName and Comments, get the idea.

In order for the code to work on your project we need to make sure that the variable fields in flash are captured by the php code.

Don’t worry about the rest of the php code, we can tailor that later to capture things such as browser type of the person that filled out the info and dates and times etc.

I am new to php and flash and only figured this out through trial and research. I can help you as much as you need it, but first make sure the form is ready to go, with variable names assigned etc. Why not post the variable names so we can start building the php code.

My knowledge is not limitless but I can get you up and running

Actually I already did that part and it works well with free emailer service from response-o-matic. The thing is I wanted to use loadVariables instead of getURL which opens a new window. I don’t want that.

I have attached the Flash form here. Please see if it is okay!

Can I add new variable to the PHP script. In case I want to add some more fields in the form or radio buttons and stuff?

comicGeek

:-\

Of course you can add new variables in the php script.

All php variables begin with $name.

If you use checkboxes then as long as they are associated with variables in flash, they can be carried over into php. This is the method I used with my own php script.

I don’t have flash on my cpu at work but I will copy your fla over to my home machine and look at it tonight.

That would be great thanks. I’ll wait for the results! heheehe

:slight_smile:

Thanks

I have a bit of time to do the fla and php script for you. Before I do can I ask if you still need it. I don’t want to waste my time doing it if you have sussed it out.

Come back to me and I can do the bits you need. It should only take a few moments.

I’m okay now I made my own script after some reading on php. thanks for the help!

:slight_smile:

comicGeek