This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > December 2005 > php contact form troubles





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author php contact form troubles
Jazztastic

2005-12-30, 6:29 pm

I'm trying to create a contact form in php, but with no luck. I
contacted my provider and the came up with the following:

(quote)
For the mail function to work, you must send the mail as if it were
from A VALID Premium Hosting POP3 account. You do this by including the
name of the account in the mail headers, such as...

mail('nobody@example.com', 'the subject', 'the message', null, '-f{put
your pop3 email address here}');

OR

$to = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: {put your pop3 email address here}' . "/r/n";
mail($to, $subject, $message, $headers);
(/quote)

The script that handles the form is:

# RegisterGlobals ON

$FTGfirstlastname = $_POST['firstlastname'];
$FTGemail = $_POST['email'];
$FTGrepeatemail = $_POST['repeatemail'];
$FTGage = $_POST['age'];
$FTGcpubrand = $_POST['cpubrand'];
$FTGSubmit = $_POST['Submit'];

# Redirect user to the error page

if ($validationFailed == true) {

header("Location: error.html");
exit;

}

# Email to Form Owner

$emailTo = '"name" <info@mysite.info>';

$emailSubject = "The contact form";

$emailBody = "firstlastname: $FTGfirstlastname\n"
. "email: $FTGemail\n"
. "repeatemail: $FTGrepeatemail\n"
. "age: $FTGage\n"
. "cpubrand: $FTGcpubrand\n"
. "Submit: $FTGSubmit\n"
. "\n"
. "";

$emailHeader = "From: $FTGemail\n"
. "Reply-To: $FTGemail\n"
. "Content-type: text/plain; charset=\"ISO-8859-1\"\n"
. "Content-transfer-encoding: quoted-printable;\n";

mail($emailTo, $emailSubject, $emailBody, $emailHeader);

# Redirect user to success page

header("Location: success.html");
exit;


Thanks in advance

Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews