Archives

July 2016
December 2015
December 2013
April 2013
January 2013
December 2011
November 2011
September 2011
December 2010
November 2010
March 2010
February 2010
January 2010



PHP Feed Back Form 5-3-2010

It is nice to meet you again in the Feed Back Form development through the following codes, and the Feed Back Form is consisted of two main pages. The first page is the HTML form while the second page is the PHP, ASP or JSP page where the second page has to receive the sent data and send it again to the Email address. Let us first start with the HTML form page.


1- HTML Form Page:


<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">

<title> Form Page</title>

</head>

<body>

<form action="send.php" method="POST">

First Name: <input type="text" name="first" value="">

<br>

Last Name: <input type="text" name="last" value="">

<br>

Mobile: <input type="text" name="mobile" value="">

<br>

Country: <input type="text" name="country" value="">

<br>

Email: <input type="text" name="email" value="">

<br>

Body: <textarea cols="40" rows="8" name="body"></textarea>

<br>

<input type="submit" name="" value="SEND">

</form>

</body>

</html>


2- PHP send.php Page:


<?php



// Receiving the data from the fields and set the data to a variables

$first = $_POST[first];

$last = $_POST[last];

$mobile = $_POST[mobile];

$country = $_POST[country];

$email = $_POST[email];

$body = $_POST[body];



// Testing the missing data

if ($first == "" || $last == "" || $mobile == "" || $country == "" || $body == ""){

    print "Missing data sent, please check the data before sending";

    print "<a href='javascript:history.go(-1);'>BACK</a>";

    exit;

}



// Testing the validation of the Email

if (eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $email)) {

    print "Please check the Email format before sending";

    print "<a href='javascript:history.go(-1);'>BACK</a>";

    exit;

}




// defining the sent data

$to = "youremail@companyname.com"';

$subject = "Message from your website";

$body = strip_tags($body);

$header = "From: ". $first . " <" . $email . ">\r\n";



// Sending the mail

$sent = mail($to,$subject,$body,$header);



// Testing the sent status

if($sent){

    print "Your mail has been sent successfully";

}

?>




Regards,

Wail Shalabi.

 


 

Leave your comment
* Name:
* Email:
* Subject:
* Comment:
* Confirm: Please write the code above
 

Contacts

Mob: +4915753779176
E-Mail: wail(at)wailshalabi.com
Web: www.wailshalabi.com

Feed back form

 
Tags

PROJECT WEBSITE ABILITY LIKE SEARCH NIZAR VALUE QABBANI USERNAME NAME RESULTS USING WHERE ONE MYSQL TEXT APPLICATION NEW FOLLOWING DATA POST CODE TITLE EXAMPLE KNOW SEE SERVER KASS TIME WORDS COM OUT TYPE PRINT FILE HEAD VIDEOS NOT HOPE INTERNET WOULD TAG EMAIL ANY FRIENDS FORM AFTER PROGRAM GOING WHILE WORLD MORE SAME HTTP LAST ASP WILL PASSWORD CLIPS WRITE DEAR AGAIN MOBILE FINALLY NUMBER EVERY SENT COOKIES CSS PUT OPEN WORD SEND BACK WWW THEM SCRIPT TELL NOW PHRASE INPUT DATABASE CONNECT GOOGLE FTP TOP VARIABLE QUIZ SHOOF JSP