Created
December 12, 2012 01:02
-
-
Save taylorlapeyre/4263935 to your computer and use it in GitHub Desktop.
Simple PHP form example.
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
<html> | |
<head> | |
<title>Basic Form</title> | |
<style type="text/css"> | |
label, input { display: block; } | |
</style> | |
</head> | |
<body> | |
<h2>Basic Form</h2> | |
<form method="post" action="report.php"> | |
<label for="firstname">First name:</label> | |
<input type="text" id="firstname" name="firstname"> | |
<label for="lastname">Last name:</label> | |
<input type="text" id="lastname" name="lastname"> | |
<label for="email">Email Address:</label> | |
<input type="text" id="email" name="email"> | |
<input type="submit" value="Submit" name="submit" /> | |
</form> | |
</body> | |
</html> |
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
<html> | |
<head> | |
<title>Basic Form - Results</title> | |
</head> | |
<body> | |
<h2>Basic Form</h2> | |
<?php | |
$name = $_POST['firstname'] . ' ' . $_POST['lastname']; | |
$email = $_POST['email']; | |
echo 'Thanks for submitting the form.<br>'; | |
echo 'Your name is ' . $name . '<br>'; | |
echo 'Your email address is ' . $email . '<br>'; | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment