...

View Full Version : PHP Beginner needs help with email form



jabrennan
01-16-2008, 04: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!


<html>



<title>E-mail SeriouslyGuys</title>



<body>

<center>

<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">

<br>

Your E-mail: <br>

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

<br>

Subject: <br>

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

<br>

Message:<br>

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

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

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

</form>





<?php

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

?>

</center>

</body>

StupidRalph
01-16-2008, 06: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">

shyam
01-16-2008, 07: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

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

or

extract($HTTP_POST_VARS);
if($submit){...

jabrennan
01-16-2008, 11:39 PM
Thanks kairog...adding

extract($HTTP_POST_VARS);

made it work perfectly.

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

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum