send mail form not sending mail
I have a form that pops up when the user clicks a link and then sends an email to the address of their choice. The form looks great, but the email isn't getting sent...
<a href='#emailpopup' id='sendMessage'><img src="images/email.jpg"></a>
<div id="tellfriend" class="contact_form">
<a class="close" href="#close" >Close</a>
<form id='tellafriend_form' method="post" action="http://naturesfootprintinc.com/sendmail.php">
<label for="name">Your Name: 开发者_开发百科</label>
<input class="std_input" type="text" id="name" name="name" size="40" maxlength="35" value="" />
<label for="to">Friend's email: </label>
<input class="std_input" type="text" id="to" name="to" size="40" maxlength="35" />
<label for="subject">Subject: </label>
<input class="std_input" type="text" id="subject" name="subject" size="40" value="Check this out!!" />
<label for="message">Message: </label>
<textarea id="message" name="message" readonly="readonly" rows="18" cols="40">Custom message</textarea>
<input type="submit" name="submit" class="form_but" value="Submit"/>
</form>
</div><!-- #tellfriend -->
Scripts used:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript"></script>
<script>
$(function() {
$('#tellfriend').hide();
$('#sendMessage').click(function(e) {
$("#tellfriend").fadeToggle('fast');
});
});
</script>
Sendmail.php:
<body>
<div id="thankyou">
<h1><strong>Thanks for sharing!</strong></h1>
<p><a href="http://homepage.com">Back to homepage</a></p>
</div>
</body>
Yeah, I'm a novice here. Thanks for your help and patience.
You need some server side code to send the mail. Just having a form doesn't do anything for you
So to send it on that click:
$('#sendMessage').click(function(e) {
var $form = $('#tellafriend_form');
$.post($form.get(0).action, $form.serialize(), function(data){
//something on success
})
$("#tellfriend").fadeToggle('fast');
});
精彩评论