When I click on the button it is not working but when i refresh the page the mails are going.Please suggest me how to solve this problem.

     <button type="submit" title="<?php echo $this->__('Email Me') ?>"  class="button"><span><span><?php echo $this->__('Email Me')?></span></span></button>

<?php
$email=$_POST['email'];
$name=$_POST['name'];
$to=$email;
$subject= "New Application";
$message= "Name: ".$name;
$headers= "From: admin@labwise.in" . "\r\n" .
mail($to, $subject, $message, $headers);
?> 

Recommended Answers

All 6 Replies

Whats the action on your <form> element?

Also, the method name in $this->__('Email Me') does not seem to be valid or is my knowledge of PHP a bit shaky?

@cereal, thnx, I was not aware of that.

OK.Can we add variables in subject in mail function

Yes. You can use a variable to prepare a string for the subject. Please note that subject must satisfy RFC 2047. See the PHP mail documentation.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.