Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Novice PHP contact form question

Sending automated email to applicant

10:41 am on Apr 23, 2004 (gmt 0)

New User

10+ Year Member

joined:Mar 12, 2004
votes: 0


I'm really new to PHP scripting and any server side at all. I would immensely appreciate if anyone could possibly help me sort out my problem.

$mail_subject = "Online Application Request";
$mail_template = 'Text of the applicant message:
Name: {NAME}
Email: {EMAIL}
Phone: {PHONE}
Citizenship: {CITIZENSHIP}
Mailing Address: {MAILING_ADDRESS}
Preffered Contact Method: {IN_TOUCH}
Preferred Season: {SEASON}
Referrer To Site: {WEBSITE_REFERRER}

$season_array = array("early_June" => "First 2 weeks (early June)",
"late_June" => "Week 3-4 (mid and late June)",
"PrimeTime" => "Prime time (end June through early July)",
"Late_July" => "Mid and late July",
"early_August" => "Early August",
"late_August_or_other" => "Late August or other");
$in_touch = array();
if ($email_touch)
array_push($in_touch, 'Email');
if ($phone_touch)
array_push($in_touch, 'Phone');
if ($snail_mail)
array_push($in_touch, 'Snail Mail');
if ($personal_meeting)
array_push($in_touch, 'Personal Meeting');

$patterns=array('/{NAME}/', '/{EMAIL}/', '/{PHONE}/', '/{CITIZENSHIP}/', '/{MAILING_ADDRESS}/', '/{IN_TOUCH}/', '/{SEASON}/', '/{WEBSITE_REFERRER}/', '/{INFO}/');
$repacement=array($name, $email, $phone, $citizenship, $mailing_address, implode(',', $in_touch), $season_array{$season}, $website_referrer, $info);
mail ($email_to, $mail_subject, $mail_template);

$mail_subject = "Your request is being processed";
$mail_template = 'Dear {NAME}! some message goes here with {EMAIL} and other variables';

header("Location: $redirect_url");

I would appreciate any assistance! I'm sure there's smth obvious missing here...


11:48 am on Apr 23, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 22, 2002
votes: 0

Hello, it appears that you just need to rearrange the order of your code a bit. This line:

mail ($email_to, $mail_subject, $mail_template);

Actually sends the mail, yet it references two undefined(as yet) variables...$email_to and $mail_subject. Also, your preg_replace statement references an undefined var, $mail_template.

Try moving the whole lower block(except header()) to a point above the preg_replace and mail functions. I think it'll work then.

God luck,


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members