Feedback PHP Development Delhi

In this article I explain how to create a simple feedback form, and how to send the data entered on that form to an email address.

Two web pages need to be produced to perform this task:

feedback.htm – the feedback form itself, and processData.php – the form handler that processes the data entered on the form:

feedback.htm

  • < html >
  • < head >< /head >
  • < body >
  • < table cellpadding=”6″ >
  • < tr >
  • < td bgcolor=”#E0F0F0″ style=”border-top:1px solid #009999;border-right:1px solid #009999;border-left:1px solid #009999;border-bottom:1px solid #009999;” >
  • < h2 >Feedback Form< /h2 >
  • If you want to provide any feedback on this website, either positive or negative, please use this form to do so.
  • < form name=”form1″ method=”post” action=”processData.php” onSubmit=’return checkfields()’ >
  • Subject
  • < br >< input type=”text” name=”title” size=”50″ >
  • . Enter text
  • < br >< textarea rows=”8″ cols=”43″ name=”comments” >< /textarea >
  • From (your email address)
  • < br >< input type=”text” name=”from” size=”50″ >16. < br >
  • < input type=”submit” name=”Submit” value=”Send Feedback” >
  • < /form >
  • < /td >
  • < /tr >
  • < /table >
  • < /body >
  • < /html >


This is the form presented to the web site visitor. There are only three fields, but you could obviously have as many as you wanted to on your own form.

Web Development Delhi

When the web site visitor clicks the Send Feedback button, the data entered into the three fields is sent to processData.php.

processData.php

  • < ?php // This page sends the feedback entered in the form to an email address
  • $title=$_REQUEST[‘title’];
  • $comments=$_REQUEST[‘comments’];
  • $from=$_REQUEST[‘from’];
  • // Email feedback to a specified email address
  • $email = “someone@somewhere.com”;
  • // The subject $subject = “Feedback from website”;
  • // The message $message = “Title:”. “$title”. “Comments:”. “$comments”. “From:”. “$from”;
  • mail($email, $subject, $message, “From: $from”); ? >
  • < html >
  • < head >
  • < /head >
  • < body >
  • Thank you for your feedback.
  • < br >
  • Kind Regards
  • < /body >
  • < /html >

(Please note: lines 11 to 16 should really include a few backslash n’s to introduce a few line breaks into the email message. Unfortunately, due to display considerations, I had to drop them from this sample code.)

There are two main areas to this web page: a PHP script at the top and an HTML area at the bottom. The PHP script gets the data from the form and puts them into three variables ($title, $comments, and $from). A subject variable ($subject) is also defined. The PHP mail function processes these variables and generates an email message that is sent to the email address defined in $email.

The bit of HTML at the bottom of the web page simply displays a message to the web site visitor after the email has been sent. If you face any problem in getting firm for this work to complete then come to the world of webdhoom.com

Sandeep Shankar

Author at Webdhoom
Sandeep Shankar is a content writer with Webdhoom, a digital marketing firm, which assists both startups and established businesses to improve online traffic, reach out to target audience, increase sales and build loyal customers through best SEO and SMO services. His articles and blogs are widely read and shared on different online platforms.
Sandeep Shankar
Sandeep Shankar
Sandeep Shankar is a content writer with Webdhoom, a digital marketing firm, which assists both startups and established businesses to improve online traffic, reach out to target audience, increase sales and build loyal customers through best SEO and SMO services. His articles and blogs are widely read and shared on different online platforms.