Advertisement
Advertisement
| 07.09.2008 at 02:11PM PDT, ID: 23551904 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: |
<?php
//set flag to indicate whether mail has been sent
$mailSent=false;
if (array_key_exists('ewComments', $_POST)) {
// mail processing script
// remove escape characters from POST array
if (get_magic_quotes_gpc()) {
function stripslashes_deep($value) {
$value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
return $value;
}
$_POST = array_map('stripslashes_deep', $_POST);
}
//validate the imput
$fname = trim($_POST['fristname']);
if (empty($firstname)){
$error['firstname']="Please enter your first name";
}
//validate the imput
$lname = trim($_POST['lastname']);
if (empty($lastname)){
$error['lastname']="Please enter your last name";
}
//validate the imput
$tel = trim($_POST['tel']);
if (empty($tel)){
$error['tel']="Please enter your telephone number";
}
$email = $_POST['email'];
// check for valid email address
$pattern = '/^[^@]+@[^\s\r\n\'";,@%]+$/';
if (!preg_match($pattern, trim($email))) {
$error['email'] = 'Please enter a valid email address';
}
//check content of text area
$messageBody = trim($_POST['message']);
if (empty($messageBody)){
$error['message'] = 'Please enter your message';
}
//initialize variables
$to = 'geoffrey@geoffreyxlane.com';/*your email address*/
$subject = 'GXL Website Contact Form';
//build the message
$message = "First Name: $firstname\n\n";
$message .= "Last Name: $lastname\n\n";
$message .= "Email: $email\n\n";
$message .= "Telephone: $tel\n\n";
$message .= "Message: $messageBody";
// create additional headers
$additionalHeaders = 'From: GXL Contact Form';
if (!empty($email)) {
$additionalHeaders .= "\r\nReply-To: $email";
}
//create subject2
$subject2 = 'Thank you from Geoffrey X Lane';
//create message2
$message2 = '
Thank you for contacting Geoffrey X Lane. Geoffrey will be in touch with you within 24hours.
';
//create Header2
$additionalHeaders2 = 'From: geoffreyxlane.com';
//send the message if there are no errors
if(!isset($error)){
$mailSent = mail($to, $subject, $message, $additionalHeaders);
//check that mail was sent sucessfully
if(!$mailSent){
$error['notSent'] = 'Sorry there was a problem submitting your form. Please try again';
}
//send message to user
if(!isset($error)){
mail($email, $subject2, $message2, $additionalHeaders2);
}
}
}
?>
<!--
function MM_validateForm() { //v4.0
if (document.getElementById){
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
} }
/*form*/
<?php if(isset($error['notSent'])){ ?>
<h5 class="warning">SERVER ERROR</h5>
<p class="warning"><?php echo $error['notSent'];?></p>
<?php } elseif ($mailSent) { ?>
<H5 class="warning">THANK YOU!</H5>
<p> Thank you for your inquiry. Geoffrey will be in touch with you shortly.</p>
<?php } else { ?>
<p> </p>
<?php } ?>
<form action="<?php $_SERVER['PHP_SELF'];?>" method="post" name="contactForm" id="contactForm" onSubmit="MM_validateForm('firstname','','R','lastname','','R','tel','','R','email','','RisEmail');return document.MM_returnValue">
<p>
<label for="fname"><span>First Name:</span></label>
<?php if (isset($error['firstname'])){ ?>
<span class="warning"><?php echo $error['firstname']; ?></span>
<?php } ?>
<input type="text" name="firstname" id="firstname"
<?php if(isset($error)) {echo "value='$firstname'";}?>/>
</p>
<p>
<label for="lastname"><span>Last Name:</span></label>
<?php if (isset($error['lastname'])){ ?>
<span class="warning"><?php echo $error['lastname']; ?></span>
<?php } ?>
<input type="text" name="lastname" id="lastname"
<?php if(isset($error)) {echo "value='$lastname'";}?>/>
</p>
<p>
<label for="tel"><span>Telephone:</span></label>
<?php if (isset($error['tel'])){ ?>
<span class="warning"><?php echo $error['tel']; ?></span>
<?php } ?>
<input type="text" name="tel" id="tel"
<?php if(isset($error)) {echo "value='$tel'";}?>
/>
</p>
<p>
<label for="email"><span>Email:</span></label>
<?php if (isset($error['email'])){ ?>
<span class="warning"><?php echo $error['email']; ?></span>
<?php } ?>
<input type="text" name="email" id="email"
<?php if(isset($error)) {echo "value='$email'";}?>/>
</p>
<p>
<label for="message">Comments/Questions:</label>
<?php if (isset($error['message'])){ ?>
<span class="warning"><?php echo $error['message']; ?></span>
<?php } ?>
<textarea name="message" id="message" cols="30" rows="5"><?php if(isset($error)){echo $messageBody;}?>
</textarea>
</p>
<p>
<label for="ewComments"></label>
<input type="submit" name="ewComments" id="ewComments" value="Send" />
</p>
</form>
|