Contact Script Errors
Posted: Sat Feb 19, 2005 10:43 pm
Hi guys. I am working to get a new type of contact system working for my customer. What I have so far is the form, the actual error checking (basic stuff) and the mail. Here's what happens:
I enter the website, and input all the required info (everything) and hit Send. The page does its thing, and then spits out my thank-you page (as expected). Later I don't get an email message in my inbox.
Let me explain this a little bit, in case you are confused.
The user pulls up the page (http://domain.com/index.php?pageid=5) and that shows the contact form. They fill in the values and click send. The script sends the values to itself, and refreshes. So from there, the top script checks to see if the hidden variable 'contact' has been set to 'send'. If so, then it loops through the error handeling and sets the error code to the correct code, and the pageID to the contact form.
The contact form is a 5 part switch of each error code. Each code gives a different form. Right now, I'm not getting too much to happen other than the page refreshes, and my content then disappears. No thank-you page, no error page, nothing.
Any help would be greatly appreciated. I am continuing to work on this after I post this, so if I all of the sudden post [RESOLVED] in front of the title, I got it working.
Feel free to IM me (bpat1434) if you want to.
~Brett
I enter the website, and input all the required info (everything) and hit Send. The page does its thing, and then spits out my thank-you page (as expected). Later I don't get an email message in my inbox.
Code: Select all
if($_REQUESTї'contact'] == 'send'){
$breaks = array("\r", "\n", "\r\n", "<br>", "<br />");
$Email = $_REQUESTї'email'];
$Comments = $_REQUESTї'comments'];
$Name = $_REQUESTї'fullname'];
$Recip = $_REQUESTї'recip'];
$Subject = 'їRSC] '.eregi_replace($breaks, " ", $_REQUESTї'subject']);
$Today = date("l F d, Y");
$Time = date("g:i A");
if(empty($Email)){
$_REQUESTї'ec'] = '1';
}
else if(empty($Name)){
$_REQUESTї'ec'] = '2';
}
else if(empty($Recip)){
$_REQUESTї'ec'] = '3';
}
else if(empty($Subject)){
$_REQUESTї'ec'] = '4';
}
else if(empty($Comments)){
$_REQUESTї'ec'] = '5';
}
else{
$comments = wordwrap($Comments, 70);
$headers = "From: ".$Name." "."<".$Email.">";
$MessageHeader ="This is an email from the Ridge Swim Club Website.\n\n
This message was sent by:\n
Name:\t$Name\n
Email:\t$Email\n\n";
$MessageBody = ">========== Message ==========<\n\n
$comments\n\n
>========== End Message ==========<\n";
$MessageFooter = "Message sent on: $Today at $Time.";
$WholeMessage = "$MessageHeader $MessageBody $MessageFooter";
$Message = eregi_replace($breaks, "\n", $WholeMessage);
$message = stripslashes($Message);
$mailed = mail($Recip, $Subject, $message, $headers);
if($mailed === 'true'){
$_REQUESTї'pageid'] = '22';
}
else{
$_REQUESTї'pageid'] = '23';
}
}
}Code: Select all
<form name='contactForm' method='POST' >
<input type='hidden' name='contact' value='send' />
<table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td valign='top' align='right'><b>Recipient:</b></td>
<td align='left'>
<select name='recip' id='recip'>
<option selected>Please choose from Below</option>
<optgroup label='Board Members'>
<option value='*********@********.com'>President</option>
<option Value='*********@********.com'>Vice President</option>
<option value='*********@********.com'>Membership</option>
</optgroup>
<optgroup label='Administrative'>
<option value=''>Pool Manager - COMING SOON</option>
<option value=''>Pool Manager - COMING SOON</option>
<option value='*********@********.com'>Webmaster</option>
</optgroup>
</select></td>
</tr>
<tr>
<td valign='top' align='right'>Your Name:</td>
<td align='left'>
<input name='fullname' type='text' value='Your Full Name' size='40' onfocus='if(this.value=='Your Full Name') value=''' />
</td>
</tr>
<tr>
<td valign='top' align='right'>Your Email Address: </td>
<td align='left'>
<input name='email' type='text' value='Your Email' size='40' onFocus='if(this.value=='Your Email') value='''>
</td>
</tr>
<tr>
<td valign='top' align='right'>Subject of Email:</td>
<td align='left'>
<input name='subject' type='text' value='Subject of the Email' size='40' onFocus='if(this.value=='Subject of the Email') value='''>
</td>
</tr>
<tr>
<td valign='top' align='right'>Your Comments: </td>
<td align='left'>
<textarea name='comments' cols='36' rows='10' id='comments' onFocus='if(this.value=='Your comments...') value='''>Your comments...</textarea>
</td>
</tr>
<tr>
<td valign='top'> </td>
<td><input type='submit' value='..:: SEND ::..'></td>
</tr>
</table>
</form>The user pulls up the page (http://domain.com/index.php?pageid=5) and that shows the contact form. They fill in the values and click send. The script sends the values to itself, and refreshes. So from there, the top script checks to see if the hidden variable 'contact' has been set to 'send'. If so, then it loops through the error handeling and sets the error code to the correct code, and the pageID to the contact form.
The contact form is a 5 part switch of each error code. Each code gives a different form. Right now, I'm not getting too much to happen other than the page refreshes, and my content then disappears. No thank-you page, no error page, nothing.
Any help would be greatly appreciated. I am continuing to work on this after I post this, so if I all of the sudden post [RESOLVED] in front of the title, I got it working.
Feel free to IM me (bpat1434) if you want to.
~Brett