Skip to content

Instantly share code, notes, and snippets.

@jkuip
Created September 18, 2015 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jkuip/b1692c3bd5254c564317 to your computer and use it in GitHub Desktop.
Save jkuip/b1692c3bd5254c564317 to your computer and use it in GitHub Desktop.
Simple PHP greeting
<!DOCTYPE html>
<html>
<head>
<title>Greeting</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container" style="margin-top: 50px">
<?php
// If the submit button has been pressed
if(isset($_POST['submit']))
{
// Print greeting to browser
echo "<h1>Hello " . $_POST['firstname'] . "</h1>";
}
?>
<!-- HTML form -->
<form method="post" action="greeting.php">
<div class="form-group">
<label>What is your first name?</label>
<input name="firstname" type="text" class="form-control" />
</div>
<input name="submit" type="submit" value="Go" class="btn btn-primary" />
</form>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment