PDA

View Full Version : Contact Form Won't Work


Hunkorama417
10-01-2000, 09:18 PM
My web site is http://www.fbhm.com. If you visit the contact page http://www.fbhm.com/contact.html (PHP page) and don't fill out the form, but press submit it asks you to include a subject. It should however ask you to fill out a name, then an e-mail address, then a subject, and then a message; however, it skips the name and e-mail address while validating the form. Also, when I filled out the form with the following values the from address which should be the value of the e-mail field arrived in my inbox with the address test@test.com.

Name: testName (doesn't validate)
Email: test (should validate for valid e-mail)
Subject: testSubject
Message: testMessage

My PHP code is as follows:

<?php
$recipient = &quot;info@fbhm.com&quot;;

function errorHTML ($msg) {
[nbsp][nbsp][nbsp][nbsp]echo &quot;<table width=425 border=0 align=center cellpadding=2 cellspacing=2>\n&quot;;
[nbsp][nbsp][nbsp][nbsp]echo &quot;<tr>\n&quot;;
[nbsp][nbsp][nbsp][nbsp]echo &quot;<td>\n&quot;;
[nbsp][nbsp][nbsp][nbsp]echo &quot;<span class=header>Error!</span>
\n&quot;;
[nbsp][nbsp][nbsp][nbsp]echo $msg . &quot;\n&quot;;
[nbsp][nbsp][nbsp][nbsp]echo &quot;</td>\n&quot;;
[nbsp][nbsp][nbsp][nbsp]echo &quot;</tr>\n&quot;;
[nbsp][nbsp][nbsp][nbsp]echo &quot;</table>\n&quot;;
[nbsp][nbsp][nbsp][nbsp]echo &quot;
\n&quot;;
}

function thanksHTML ($msg) {
[nbsp][nbsp][nbsp][nbsp]echo &quot;<table width=425 border=0 align=center cellpadding=2 cellspacing=2>\n&quot;;
[nbsp][nbsp][nbsp][nbsp]echo &quot;<tr>\n&quot;;
[nbsp][nbsp][nbsp][nbsp]echo &quot;<td>\n&quot;;
[nbsp][nbsp][nbsp][nbsp]echo &quot;<span class=header>Thanks!</span>
\n&quot;;
[nbsp][nbsp][nbsp][nbsp]echo $msg . &quot;\n&quot;;
[nbsp][nbsp][nbsp][nbsp]echo &quot;</td>\n&quot;;
[nbsp][nbsp][nbsp][nbsp]echo &quot;</tr>\n&quot;;
[nbsp][nbsp][nbsp][nbsp]echo &quot;</table>\n&quot;;
[nbsp][nbsp][nbsp][nbsp]echo &quot;
\n&quot;;
}

if ($submit) {
[nbsp][nbsp][nbsp][nbsp]if ($name == &quot;&quot;)
[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp]errorHTML (&quot;You must include a name. Please go <a href=javascript:window.history.go(-1);>back</a> and fill out this information then re-submit the form again.&quot;);
[nbsp][nbsp][nbsp][nbsp]else if (!ereg ('^[-!#$%&amp;\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&amp;\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%&amp;\'*+\\./0--9=?A-Z^_`a-z{|}~]+$', $email))
[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp]errorHTML (&quot;You must include a valid e-mail address. Please go <a href=javascript:window.history.go(-1);>back</a> and fill out this information then re-submit the form again.&quot;);
[nbsp][nbsp][nbsp][nbsp]else if ($subject == &quot;&quot;)
[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp]errorHTML (&quot;You must include a subject. Please go <a href=javascript:window.history.go(-1);>back</a> and fill out this information then re-submit the form again.&quot;);
[nbsp][nbsp][nbsp][nbsp]else if ($message == &quot;&quot;)
[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp]errorHTML (&quot;You must include a message. Please go <a href=javascript:window.history.go(-1);>back</a> and fill out this information then re-submit the form again.&quot;);
[nbsp][nbsp][nbsp][nbsp]else {
[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp]if (@mail (&quot;$recipient&quot;, &quot;$subject&quot;, &quot;$message&quot;, &quot;From: $email\r\nReply-to: $email\r\n&quot;))
[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp]thanksHTML (&quot;Your message has been sent and we look forward to receiving it.&quot;);
[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp]else
[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp]errorHTML (&quot;Your message wasn't sent for various reasons. Please go <a href=javascript:window.history.go(-1);>back</a> and try again&quot;);
[nbsp][nbsp][nbsp][nbsp]}
}
else {
?>
FORM GOES HERE
<?php } ?>


The strange thing about all of this was it was working a couple weeks ago and all of a sudden it doesn't. So I'm inclined to believe this to be an error with FutureQuest's PHP configuration. Please help!!<!-- NO_AUTO_LINK -->
------------------
Andrew
www.digi-FX.net (http://www.digi-FX.net)

PaulKroll
10-02-2000, 12:52 AM
From here, it DOES ask me for a name, then e-mail, then refuses &quot;test&quot; but accepts &quot;test@test.com&quot;, then subject, then message, then it says it's sent it.

Is it possible this is a browser caching thing? THat would be weird, but certainly not impossible (IE is a mysterious, and frustrating, thing...) :)

Hunkorama417
10-02-2000, 11:12 AM
It does work. Must have been a problem with IE.