Created
September 18, 2015 15:15
-
-
Save jkuip/b1692c3bd5254c564317 to your computer and use it in GitHub Desktop.
Simple PHP greeting
This file contains hidden or 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> | |
<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