View Full Version : PHP Beginner needs help with email form

01-16-2008, 05:33 AM
I created an email form for my fiance and his friends' website, SeriouslyGuys <http://www.seriouslyguys.com>

When I test the form on my server, it works perfectly.

I put the form on the SeriouslyGuys server, and it doesn't deliver emails to my inbox. Both sites are hosted via GoDaddy, both on Linux machines, both with full PHP abilities.

Below is what the form looks like...its not pretty, but it serves its purpose.

If you want to test it out for your own reasons, please select "Julie Brennan" as the person you are emailing...I do not want to bug the others with junk mail please.

Working form: http://www.julie-brennan.com/misc/emailSG.php

Non-working form: http://www.seriouslyguys.com/emailSG.php

Thanks in advance!


<title>E-mail SeriouslyGuys</title>



<form action="" method="post">

Who do you want to Contact? <br>

<select name="emailto">
<option value="chris.taylor@seriouslyguys.com">Chris "Chugs" Taylor</option>
<option value="rick.snee@seriouslyguys.com">Rick Snee</option>
<option value="bryan.mcbournie@seriouslyguys.com">Bryan McBournie</option>
<option value="bryan.schools@seriouslyguys.com">Bryan Schools</option>
<option value="julie.brennan@seriouslyguys.com">Julie Brennan</option>
</select> <br>

Your Name: <br>

<input size="30" type="text" name="name">


Your E-mail: <br>

<input size="30" type="text" name="email">


Subject: <br>

<input size="30" type="text" name="subject">



<textarea name="message" cols="25" rows="5"></textarea><br>

<input type="submit" name="submit" value="Send">

<input type="reset" name="Reset" value="Reset">



if ($submit) { // if the form was sent do the following

if($emailto && $name && $subject && $email && $message ) { // if all fields were filled-in send email

mail("$emailto","$subject","$message","From: $name, $email") or die("email error");

echo "Message Sent"; // if all went well, display message was sent

} else {

echo "All fields must be filled in!"; // if not all were filled in, display error message


} // end php submission code




01-16-2008, 07:41 AM
They both worked identically for me. You may want to explicitly set the form action tho.

<form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post">

01-16-2008, 08:00 AM
i tried submitting the empty form and even the error message is not echoed in http://www.seriouslyguys.com/emailSG.php

since ur referring to the post vars as simply $submit i'm assuming ur using import_request_variables i think register_globals is on on or some such error

take a look here http://php.net/manual/en/function.import-request-variables.php

01-16-2008, 04:58 PM
I think adding extract() command like the one below will solve your problem...
if ($submit) { ...



01-17-2008, 12:39 AM
Thanks kairog...adding


made it work perfectly.

Thanks to everyone who gave feedback, I really appreciate it!

01-17-2008, 01:05 AM
Is Go Daddy using PHP < 4.1?