Skip to content

Instantly share code, notes, and snippets.

@taylorlapeyre
Created December 12, 2012 01:02
Show Gist options
  • Save taylorlapeyre/4263935 to your computer and use it in GitHub Desktop.
Save taylorlapeyre/4263935 to your computer and use it in GitHub Desktop.
Simple PHP form example.
<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>
<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