Ok, i have optimized the script. I now have no error on contact.php working, but it will not send the mail. All variables are defined on contact.php
contact.html (an included code on a php page, is the submission form
<?php
$getip = $_SERVER['REMOTE_ADDR'];
?>
<form action="contact.php" method="post">
<table width="100%" border="0" cellspacing="5" cellpadding="0" class="page">
<tr>
<td>
<strong>Category</strong>
<br>
<select style="width:100%;" name="account">
<option value="contact" selected>General Feedback</option>
<option value="affiliates">Affiliation Notification</option>
<option value="gamehelp" disabled>Game Support (game help)</option>
<option value="contact">Report an Error</option>
<option value="contact" disabled>Staff Application</option>
</select> </td>
<td>
<strong>Your Email Address</strong>
<br>
<input name="senderemail" type="text" size="50" style="width:100%;" class="bginput"></td>
</tr>
<tr>
<td>
<strong>Your Subject</strong>
<br>
<input name="subject" type="text" size="50" style="width:100%;" class="bginput"></td>
<td>
<strong>Your IP Address*</strong>
<br>
<input name="senderip" type="text" class="bginput" style="width:100%;" value="<?=$getip?>" size="50" disabled></td>
</tr>
<tr>
<td colspan="2">
<strong>Your Message</strong>
<br>
<textarea name="message" rows="25" cols="60" wrap="virtual" style="width:100%; height:250px" tabindex="1" class="textarea">Please type your message here.</textarea></td>
</tr>
<tr>
<td width="50%">
<input name="copy" type="checkbox" class="bginput" checked>
Do you want a copy sent to your email?</td>
<td width="50%">
<input name="terms" type="checkbox" class="bginput">
I fully agree with GH's <a href="#">Submission Policy</a>.
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input value="Send Message" type="submit" class="button">
<input value="Reset Message" type="reset" class="button"></td>
</tr>
</table>
<div align="center">
<strong>*For security reasons, we have recorded your IP address.</strong>
(more information)</div>
</form>
contact.php (for mailing and displaying the status message)
<?php
// Form information variable assigning
$account = $HTTP_POST_VARS['account']; // tells the email account for reciever from drop down
$address = "@gaminghybrid.com";
$subject = $HTTP_POST_VARS['subject']; // shows sender's entered "subject" information
$senderemail = $HTTP_POST_VARS['senderemail']; // shows sender's enter "email" information
$senderip = $HTTP_POST_VARS['senderip']; // shows sender's entered "email" information
$message = $HTTP_POST_VARS['message']; // contains information from message field
$copy = $HTTP_POST_VARS['copy']; // "send copy" checkbox information
$terms = $HTTP_POST_VARS['terms']; // "accept terms" checkbox information
// Send the information to requested email department, and assign process complete message variable
if ($terms == 1) {
$formsent = mail("$account$address",
"$subject",
"Sender's Email Address: $senderemail\r\n IP Address: $senderip\r\n Message:\r\n $message\r\n"); }
// If users checks "Do you want a copy sent to your email?", send copy of form information
if ($copy == 1) {
$copysent = mail("$senderemail",
"Copy: $subject",
"Your Email Address: $senderemail\r\n Your IP Address: $senderip\r\n Message:\r\n $message\r\n\r\n
This is a copy of the information $senderip entered and submitted to GamingHybrid.com via our
contact section."); }
// ############ Page Display ############ //
// Displays code to be displayed and the
// type of content depends on success.
// ###################################### //
// mail message if success.
if ($formsent == 1)
{
$path = "$contactpath Sending Successful\n"; $title = "$contacttitle Sending Successful";
echo "Sending Information...... <strong>Complete!</strong><br /><br />";
echo "<strong>Email Address:</strong><br />$senderemail<br />";
echo "<strong>Subject:</strong><br />$subject<br />";
echo "<strong>Message:</strong><br />$message<br />";
echo "<strong>IP Registered:</strong> $senderip";
// If user checked the "Send copy" bock, report with this message
if ($copy == 1) {
if ($copysent == 1) { echo "<p> </p>";
echo "Sending Copy to $senderemail...... <strong>Complete!</strong>"; }
else { echo "<p> </p>";
echo "Sending Copy to $senderemail...... <strong>Failure!</strong>"; }
}
}
// if sending is in error, report this.
else {
echo "Sending Information...... <strong>Failure!</strong><br /><br />";
echo "Oops! The information you attemped to send has encountered and error!";
// if user doesn't check the box to accept $terms, then display...
if ($terms == 0) { echo '<p> </p>';
echo "<strong>ATTENTION!:</strong><br />";
echo 'You must accept and agree with our Submission Policy'; }
// add a "go back" button.
echo '<p> </p>';
echo '<center>
<input type="button" value="Click Here to go Back" onClick="history.go(-1)" name="button">
</center>';
}
// ###################################### //
// ######### End of Page Display ######## //
// ###################################### //
?>
I hope this is more clearer. Basically, this script uses "if" commands to tell if so, or not disply information depending on the fields infomration (if option is selected). The feature of sending a copy of the email to the sender is one I have attemped in my script and the checkbox fielf of "terms" must be checked for the information to be sent, otherwise it should disply the "else" error content.
I believe it is my "if" commands that are not allowing the information to be sent, but not fully sure. So, yeah, the issue is that the information doesn't send, thus the else error message displays on contact.php.
Thank you for the help.