I’m sure it’s ridiculous, but it’s still driving me up the wall.
I’ve gone the semi-easy route and downloaded a premade script for an email form. The form will detect information that’s required before submitting, and that part of it works because if I don’t enter all of the fields with something, it will come back with an error message. However, when I get all of the information right and hit submit the ■■■■ thing will flash an error message that says it cannot modify the header information on line 90. The weirder thing is that I opened up my mailbox after one of these attempts and it’d sent my test email like 6 times… one for every time I got frustrated and hit submit again and again. My question is how do I fix this? I’m still getting a grasp on this PHP thing and I’m about to rip some hair out over this… here is my code.
HTML code:
<font style="font-size: 7.5pt;">
<FORM ACTION="emailform.php" METHOD="POST">
<B>Your Name:</B> <br /><INPUT NAME="fromname" TYPE="text" SIZE="25" style="background-color: #FDF3F7; font-size: 7.5pt; font-family: verdana; color:#828282; border: 1px solid #F1DAE4; "><BR>
<B>Your Email:</B> <br /><INPUT NAME="fromemail" TYPE="text" SIZE="25" style="background-color: #FDF3F7; font-size: 7.5pt; font-family: verdana; color:#828282; border: 1px solid #F1DAE4; "><P>
<INPUT TYPE="hidden" NAME="sendpage" VALUE="sent.php">
<INPUT TYPE="hidden" NAME="subject" VALUE="From The Website">
<INPUT TYPE="hidden" NAME="toemail" VALUE="slimjadey@swbell.net">
<INPUT TYPE="hidden" NAME="require" VALUE="fromname,fromemail,message">
<B>Message</B><BR>
<TEXTAREA NAME="message" ROWS="3" COLS="30" style="background-color: #FDF3F7; font-size: 7.5pt; font-family: verdana; color:#828282; border: 1px solid #F1DAE4; "></TEXTAREA></P>
<P><INPUT NAME="submitform" TYPE="submit" VALUE="Submit" style="background-color: #F5F5F5; font-size: 7.5pt; font-family: verdana; font-weight: bold; color:#828282; border: 1px solid #F1DAE4; "></FORM></P>
</font>
PHP code:
<HTML>
<HEAD>
<TITLE>Email Form v1.1 - Powered by: (http://www.phpscriptcenter.com/emailform.php)</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff">
<!--
Powered by: Email Form Version 1.1 (http://www.phpscriptcenter.com/emailform.php)
-->
<?php
///////////////////////////////////////////////
// //
// Email Form v 1.1 //
// ----------------------------------------- //
// by Graeme (webmaster@phpscriptcenter.com) //
// http://www.phpscriptcenter.com //
// //////////////////////////////
// PHP Script CENTER offers no warranties on this script. //
// The owner/licensee of the script is solely responsible for any //
// problems caused by installation of the script or use of the script //
// //
// All copyright notices regarding Email Form, must remain //
// intact on the scripts and in the HTML for the scripts. //
// //
// (c) Copyright 2001 PHP Script CENTER //
// //
// For more info on Email Form, //
// see http://www.phpscriptcenter.com/emailform.php //
// //
///////////////////////////////////////////////////////////////////////////
// your name
$yourname = "Your Name";
// your email
$youremail = "Your Email";
// Default Send Page
$yourdefaultsend = "http://www.phpscriptcenter.com/sent.php";
////////////////////////////////////////////////////////////////////////////
// DO NOT EDIT BELOW THIS LINE //
////////////////////////////////////////////////////////////////////////////
if($submitform) {
$dcheck = explode(",",$require);
while(list($check) = each($dcheck)) {
if(!$$dcheck[$check]) {
$error .= "Missing $dcheck[$check]<BR>";
}
}
if($error) {
?>
<P><CENTER><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD WIDTH="100%" BGCOLOR="#004080">
<TABLE WIDTH="394" BORDER="0" CELLSPACING="1" CELLPADDING="2">
<TR>
<TD WIDTH="26%" BGCOLOR="#004080">
<P><B><FONT COLOR="#ffffff" SIZE="-1" FACE="Verdana">Error</FONT></B></TD>
</TR>
<TR>
<TD WIDTH="26%" BGCOLOR="#ffffff">
<FONT COLOR="#000000" SIZE="-1" FACE="Verdana"><?php echo $error; ?></FONT></TD>
</TR>
</TABLE></TD>
</TR>
</TABLE></CENTER>
<P><CENTER> </CENTER></P>
<P><CENTER><FONT SIZE="-2" FACE="Verdana"><B>Powered by:</B> <A HREF="http://www.phpscriptcenter.com/emailform.php">Email Form</A> Version 1.1</FONT></CENTER></P>
</BODY></HTML>
<?php
exit();
}
if ($fromname) {
$yeshow = "
From, $fromname
";
}
mail($toemail,"$subject","
$message
$yeshow
","From: $fromname <$fromemail>");
header("Location: $sendpage");
exit();
} else {
?>
<FORM ACTION="emailform.php" METHOD="POST">
<P><CENTER><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD WIDTH="100%" BGCOLOR="#004080">
<TABLE WIDTH="394" BORDER="0" CELLSPACING="1" CELLPADDING="2">
<TR>
<TD COLSPAN="2" BGCOLOR="#004080">
<B><FONT COLOR="#ffffff" SIZE="-1" FACE="Verdana">Contact Form</FONT></B></TD>
</TR>
<TR>
<TD WIDTH="48%" BGCOLOR="#ffffff">
<B><FONT COLOR="#000000" SIZE="-1" FACE="Verdana">Your Name:</FONT></B></TD>
<TD WIDTH="52%" BGCOLOR="#ffffff">
<INPUT NAME="fromname" TYPE="text" SIZE="25">
</TD>
</TR>
<TR>
<TD WIDTH="48%" BGCOLOR="#ffffff">
<B><FONT COLOR="#000000" SIZE="-1" FACE="Verdana">Your Email:</FONT></B></TD>
<TD WIDTH="52%" BGCOLOR="#ffffff">
<INPUT NAME="fromemail" TYPE="text" SIZE="25">
</TD>
</TR>
<TR>
<TD COLSPAN="2" BGCOLOR="#ffffff">
<B><FONT COLOR="#000000" SIZE="-1" FACE="Verdana">Message:<BR><INPUT
TYPE="hidden" NAME="subject" VALUE="Contact Form">
<INPUT TYPE="hidden" NAME="toemail" VALUE="<?php echo $youremail; ?>">
<INPUT TYPE="hidden" NAME="toname" VALUE="<?php echo $yourname; ?>">
<INPUT TYPE="hidden" NAME="require" VALUE="fromname,fromemail,message">
<INPUT TYPE="hidden" NAME="sendpage" VALUE="<?php echo $yourdefaultsend; ?>">
<TEXTAREA NAME="message" ROWS="5" COLS="45"></TEXTAREA></FONT></B></TD>
</TR>
</TABLE></TD>
</TR>
</TABLE></CENTER></P>
<P><CENTER><INPUT NAME="submitform" TYPE="submit" VALUE="Submit"></CENTER></FORM></P>
<P><CENTER> </CENTER></P>
<P><CENTER><FONT SIZE="-2" FACE="Verdana"><B>Powered by:</B> <A HREF="http://www.phpscriptcenter.com/emailform.php">Email Form</A> Version 1.1</FONT></CENTER></P>
</BODY></HTML>
<?php
exit();
}
?>
Any help would be greatly appreciated…