It's all about Information, tricks and knowledge..

Simple Contact/Feedback Form in HTML with php (HTML-PHP mailer)

4 comments
Contact/Feedback Form

Adding a contact/feedback form helps in getting comments from visitors. These forms should not be complex and also don't add much fields for asking to visitor. Here it is a simple contact/feedback form that you can just download and apply it. Along-side the HTML form, you will find a basic PHP script which will capture the form submissions and send the form contents to your email address.

Simple Contact-Feedback Form in HTML-PHP mailer by My Blog


Form validation
Adobe® Dreamweaver® CS3 software comes with a collection of Spry widgets, which make adding dynamic elements to your websites quick and easy.  The Spry widgets are another great example of how Adobe enhances usability in CS3. The Spry framework itself is powerful and technical in nature. But the power of the widgets lies in the fact that they hide the complexity and code. With just a couple of clicks and CSS modifications, you can create a tightly integrated and highly interactive form validation with the Spry.

When you are running with localhost, you get following error:

Warning: mail(): Failed to connect to mailserver at "smtp.gmail.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in S:\wamp\www\sample\mailTo.php on line 10


You will get this error when you are trying to run in localhost. If you are hosted in your domain you won't get any error. A simple contact form with fields: Name, Email, and Message.

The PHP Code which captures and Emails you

The PHP code below is very basic. It will capture the form fields specified in the HTML form and validate. The fields are then sent off to your email address in plain text.

Note: You need to edit 3 parts of the script below. You need to tell it your email address (this will not be available for anyone to see, it is only used by the server to send your email). You can also specify an email subject line (or just leave the one which is there). After successful form submission, you have to redirect destination page or pop-up message. So, you can also specify pop-up message or thank you page. Here in this demo page, the contact/feedback mailing into your email address only. So, kindly enter yours email address to verify  (Both html & PHP files are attached in download link below).  








4 comments :

  1. hi anton

    where i need to paste the php code?
    i cant send mail.


    when i click submit its redirect to my main page but without any mail sending

    thanx

    ReplyDelete
    Replies
    1. Are you downloaded the source code that I attached here? You have to include PHP code in form action.

      Delete
  2. bro i didn't get any email in my gmail . i uploaded local server , i edit my mail address in your php code, need help bro

    ReplyDelete
    Replies
    1. In localhost it doesn't work. You have to upload it in web server and try.

      Delete