Contact Sheet...What have I done wrong? :)

Hi guys!

I am coding my portfolio website, and I absolutely love the contact form used on this site (click on contact):

I attempted to customize a php contact form for my site, and it visually is working correctly, however when I click the submit button it goes to a blank white page and doesn’t send the email. I am only slightly experienced with php but I know html well. I am including my code below. Any help would be greatly appreciated!!

The HTML file code:
CSS//

form.cool textarea{
  width:100%;
  height:300px;
  font-size:30px;
  font-family:minion pro;
  font-style:italic;
  background:transparent;
  border:none;
  outline:none;
  resize:none;
  margin-top:10px;
}

form.cool input.submit{
  text-transform:uppercase;
  background-color:#000;
  color:#fff;
  border:none;
  font-family:myriad pro;
  font-weight:bold;
  font-size:30px;
  padding:10px;
  width:200px;
  border-radius:3px;
}

form.cool input.name{
  text-transform:uppercase;
  background-color:white;
  border-style:double;
  border-color:#FCEE21;
  font-family:myriad pro;
  font-weight:bold;
  font-size:20px;
  padding:10px;
  width:200px;
  border-radius:3px;
  margin-bottom:15px;
}

SCRIPT//

<script type="text/javascript">
		$(function(){
		    var string = "Dear Caitlin,".split(''); // split the string into an array
		    var i = 0; // used to track which character we are on
		    var timer = null; // used later to store a timer

		    var nextChar = function(){
		      if(i >= string.length)
		      {
		        // if i >= string.length then we are done
		        // so stop the timer
		        clearInterval(timer)
		      }else{
		        textarea = $('form.cool textarea');
		        // get the value of the textarea
		        value = textarea.val();
		        // set the value to the current value + the next character
		        textarea.val(value + string[i]);
		        // up the counter by one so that we use the next character next time
		        i = i+1;
		      }
		    }

		    timer = setInterval(nextChar,100);

		  });
	
	</script>

HEAD//

<div id="body_wrapper">
  		<form class="cool" action="mail.php" method="POST">
			<p>NAME</p> <input type="text" name="name" class="name">
			<p>EMAIL</p> <input type="text" name="email" class="name">
		  <textarea name="message" class="cool"></textarea>
		  <input type="submit" value="send" class="submit" />
		</form>
  	</div>

The PHP file code (named mail.php):
[php]

<?php $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $formcontent="From: $name \n Message: $message"; $recipient = "[email protected]"; $subject = "Contact Form"; $mailheader = "From: $email \r\n"; mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); echo "Thank You!" Return Home"; ?>

[/php]

Also I am using MAMP to test my site on my local computer first before I publish it.

Thanks!!

Also I am using MAMP to test my site on my local computer first before I publish it.
That's the issue right there. Unless you have a local email server set up, its not going to send the email out. The best you can hope to do locally is to echo the incoming variables on the mail page.

LOL, good catch Richei… Missed that!

There is actually a way to send emails if it is on your own Windows system using Wamp. You can set up the email to use your SMTP system and mail thru your currently set up email system. It’s a bit of a pain as then you have to switch back when live. But, it can be done.

true, i use mercury mail for testing, and just send the email to a local account on it, then use Thunderbird to check the email (setting check for new emails at 1min intervals but rly that makes it open a constant connection so you get it when it arrives)

Sponsor our Newsletter | Privacy Policy | Terms of Service