I am a new website designer. I have always been into Computers and liked working with them. I got a job at local Computer Repair store ( PC Tech Computer Sales & Service ) about three years ago. After about 6 months working there the Owner told me I should learn how to build websites because he often had people inquiring about who could do one for them. I live in a small town and there is no one else in the area who offers this service. So I Learned (from Google &W3C Schools) HTML, CSS, and some JavaScript. I have done over 20 sites to date and am getting more and more work as time goes on.
I have been using a Go Daddy Shared Hosting account the entire time. I have recently became very unhappy with Go Daddy’s performance and reliability. I was contacted by viaVerio and after three months of giving them the run-around, I decided to join their “Partner Program” and purchased a WHM VPS with cPanel for $38 per month.
I know that this is a huge jump for me as far as the technical knowledge, but I also know that this is something I need to do to allow for future growth and customer satisfaction.
I have managed to get all of my currently hosted websites moved from the Go Daddy’s Server to the new VPS and all the sites are up and running. I am only having one problem, but it is quite a big deal. None of the websites “Contact Us” email forms are working.
This site ( Contact Us ) is still on the Go Daddy account and the email form works correctly.
These sites ( LDW Foundation & [url=http://habitatwise.org]Habitat For Humanity - Wise, VA - Home) are on the cPanel VPS and appears to be working, but they are not sending out the emails. I have checked the “Mail Queue Manager” and there it says “There are currently 0 messages in the mail queue.”
This site, ( Home ) and all others on the cPanel VPS come back with simply “error” when trying to use them.
I am not sure but I think that there is something I need to do on the server to fix this. The reason I think this is because if you leave the email field blank and try to submit it come back with the correct “Invalid Email Address Entered” error.
I will provide the HTML and PHP used for all sites (except the habitatwise.org)
Please forgive my very limited knowledge. I am however very eager to learn all that I can.
Thank You in advance for your time spent helping me with this problem.
<!--HTML FOR FORM-->
<h4>Please fill out the following form and we will be in touch with you soon.</h4>
<form action="contact.php" method="post" id="contactform">
<ol>
<li>
<label for="name">Your Name <span class="red">*</span></label>
<input id="name" name="name" class="text" />
</li>
<li>
<label for="email">Your email <span class="red">*</span></label>
<input id="email" name="email" class="text" />
</li>
<li>
<label for="subject">Subject</label>
<input id="subject" name="subject" class="text" />
</li>
<li>
<label for="message">Message <span class="red">*</span></label>
<textarea id="message" name="message" rows="6" cols="50"></textarea>
</li>
<li class="buttons">
<input type="image" name="imageField" id="imageField" src="images/send.gif" class="send" />
<div class="clr"></div>
</li>
</ol>
</form>
<!--CONTACT.PHP FILE CONTENTS-->
<?php
if(!$_POST) exit;
$email = $_POST['email'];
//$error[] = preg_match('/\\b[A-Z0-9._%-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS';
if(!eregi("^[a-z0-9]+([_\\\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\\.-][a-z0-9]+)*)+"."\\\\.[a-z]{2,}"."$",$email )){
$error.="Invalid email address entered";
$errors=1;
}
if($errors==1) echo $error;
else{
$values = array ('name','email','message');
$required = array('name','email','message');
$your_email = "MyEmailAddress@gmail.com";
$email_subject = "New Message: ".$_POST['subject'];
$email_content = "new message:\
";
foreach($values as $key => $value){
if(in_array($value,$required)){
if ($key != 'subject' && $key != 'company') {
if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
}
$email_content .= $value.': '.$_POST[$value]."\
";
}
}
if(@mail($your_email,$email_subject,$email_content)) {
echo 'Message sent!';
} else {
echo 'ERROR!';
}
}
?>