Last active
December 25, 2015 03:58
-
-
Save abdullahbutt/6913197 to your computer and use it in GitHub Desktop.
$_post in php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>$_Post</title> | |
<style> | |
form ul {margin:0; padding:0} | |
form li {list-style:none; margin-bottom:1em } | |
</style> | |
</head> | |
<h1>Contact Form</h1> | |
<!-- <form action="" method="get">--> | |
<form action="" method="post"> | |
<?php | |
/* if(!empty($_POST)){ | |
print_r ($_POST); | |
} | |
echo "<br>"; | |
echo $_SERVER['REQUEST_METHOD']; // If empty, says GET & if data is inserted in form, echoes Type is POST | |
*/ | |
/* if($_SERVER['REQUEST_METHOD']=="POST"){ | |
print_r($_POST); | |
}*/ | |
if ($_SERVER['REQUEST_METHOD']=='POST'){ | |
if(mail('[email protected]','Hi How r u?',$_POST['message'])){// it is the name of Message in textarea | |
$status="Thank you! for your message"; | |
} | |
} | |
?> | |
<ul> | |
<li> | |
<label for="name">Name</label> | |
<input type="text" name="name" id="name" /> | |
</li> | |
<li> | |
<label for="email">E-Mail</label> | |
<input type="text" name="email" id="email" /> | |
</li> | |
<li> | |
<label for="message">Your Message</label><br /> | |
<textarea name="message" id="message"></textarea> | |
</li> | |
<li> | |
<input type="submit" value="Go!" /> | |
</li> | |
</ul> | |
</form> | |
<?php | |
if(isset ($status)){ echo $status;} | |
?> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment