View Full Version : PHP email script with more than 3 fields?
drjugears
March 8th, 2008, 10:44 AM
Hello.
I'm trying to create a feedback form from flash that has 4 text fields.
Name
Email address
Company name
Message
There are countless tutorials out there for doing this with 3 fields, but I can't for the life of me work out how to do it with the added company data that I want added to the message. And I guess it could be scaled up to include unlimited text fields.
Anyone able to point me in the right direction?
Many thanks.
msxw
March 8th, 2008, 03:21 PM
Well, you can always re-name the first field "Name & Company".
joran420
March 8th, 2008, 05:51 PM
its easy you just add your new textfield
then in your loadvars you add a new variable for it
then in your php just use the sent info and add it to the message.
if you can get 3 fields to work you should be able to get 4 easy... if you cant post your code that does 3 (including php)
drjugears
March 9th, 2008, 04:27 AM
... if you cant post your code that does 3 (including php)
Adding the extra input box within the movieclip with the variable name "company" was of course obvious.
But I can't for the life of me work out what edits to make to the php file. I've tried a variety of things.
I just want to add the company name above the actual message text when the email is received, so it would look like:
.............................................
Company: Bob's builders
Hello there,
I'm bob, need anything built?
.............................................
The flash movie is a form consisting of 3 input text boxes.
Name
Email
Message
Each has a variable name.
The 3 are within a movie clip which has the instance name "form"
Here's the button script:
on (release) {
form.loadVariables("email.php", "POST");
}
And the php:
<?php
$sendTo = "peterlourenco@gmail.com";
$subject = "My Flash site reply";
$headers = "From: " . $_POST["firstName"] ." ". $_POST["lastname"] . "<" . $_POST["email"] .">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$headers .= "Return-path: " . $_POST["email"];
$message = $_POST["message"];
mail($sendTo, $subject, $message, $headers);
?>
Thanks for any advice.
I don't really want to lump the company and message inputs together into one text field as that would be giving up on the challenge!
joran420
March 9th, 2008, 02:10 PM
$message = $_POST["message"]."\n".$_POST["otherTextFieldVariableName"];
would add it on a line below the message in the email...
or something like
$headers = "From: " . $_POST["firstName"] ." ". $_POST["lastname"] . "(".$_POST['companyName'].")<" . $_POST["email"] .">\r\n";
would put it in the from
From Bob Smith(infoGenisis)<bob@infog.net>
its pretty straightforward really
drjugears
March 10th, 2008, 04:36 AM
Thanks very much, will have a go with that now.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.