Total members 11895 |It is currently Sun Dec 22, 2024 2:11 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Code:
<HTML>
<HEAD>
<TITLE>Feedback Form</TITLE>
</HEAD>
<BODY>
<?
$form_block = "
  <FORM METHOD=\"POST\" ACTION=\"$PHP_SELF\">
    <P><strong>Your Name:</strong><br>
    <INPUT type=\"text\" NAME=\"sender_name\" SIZE=30></P>
    <P><strong>Your E-Mail Address:</strong><br>
    <INPUT type=\"text\" NAME=\"sender_email\" SIZE=30></P>
    <P><strong>Message:</strong><br>
    <TEXTAREA NAME=\"message\" COLS=30 ROWS=5 WRAP=virtual></TEXTAREA></P>
    <INPUT type=\"hidden\" name=\"op\" value=\"ds\">
    <P><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Send This Form\"></p>
</FORM>";

if ($_POST[op] != "ds") {
     echo "$form_block";
} else if ($_POST[op] == "ds") {
     if ($_POST[sender_name] == "") {
          $name_err = "<font color=red>Please enter your name!</font><br>";
          $send = "no";
     }
     if ($_POST[sender_email] == "") {
          $email_err = "<font color=red>Please enter your
          e-mail address!</font><br>";
          $send = "no";
     }
     if ($_POST[message]== "") {
          $message_err = "<font color=red>Please enter a message!</font><br>";
          $send = "no";
     }
     if ($send != "no") {
          $msg = "E-MAIL SENT FROM java2s.com\n";
          $msg .= "Sender's Name: $_POST[sender_name]\n";
          $msg .= "Sender's E-Mail: $_POST[sender_email]\n";
          $msg .= "Message: $_POST[message]\n\n";
          $to = "[email protected]";
          $subject = "All-in-One Web Site Feedback";
          $mailheaders = "From: My Web Site
          <[email protected]>\n";
          $mailheaders .= "Reply-To: $_POST[sender_email]\n";
          mail($to, $subject, $msg, $mailheaders);
          echo "<P>Mail has been sent!</p>";
     } else if ($send == "no") {
          echo "$name_err";
          echo "$email_err";
          echo "$message_err";
          echo "$form_block";
     }
}
?>




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Feedback Form in php
 user feedback FORM ASP     -  
 FeedBack form Spam     -  
 play a sound when the user enters the area- audio feedback     -  
 php login form (sign-in form)     -  
 Upload Form     -  
 Get Form Numeric value     -  
 Seconds Form to ( hh:mm:ss) (C++)     -  
 Please help me in the form field     -  
 Form Validation Problem     -  
 use java beans with jsp form     -  



Topic Tags

PHP Forms
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com