Last active
June 8, 2016 00:14
-
-
Save kawaiidesune/6b117d0470d3cc53fe87a493a5372640 to your computer and use it in GitHub Desktop.
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 lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> | |
<title>Hello world</title> | |
<!-- Bootstrap --> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous" /> | |
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> | |
<!-- WARNING: Respond.js doesn't work if you view the page via file:// --> | |
<!--[if lt IE 9]> | |
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> | |
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> | |
<![endif]--> | |
</head> | |
<body> | |
<?php | |
if (isset($_POST['first_name'])&&isset($_POST['last_name'])) { | |
$name = $_POST['first_name'] . " " . $_POST['last_name']; | |
} elseif (isset($_POST['first_name'])||isset($_POST['last_name'])) { | |
if (isset($_POST['first_name'])) { | |
$name = $_POST['first_name']; | |
} else { | |
$name = $_POST['last_name']; | |
} | |
} | |
if ($name) { | |
echo "<h1>Hello, $name</h1>"; | |
} | |
?> | |
<form action="hello.php" method="POST"> | |
<div class="row"> | |
<label for="first_name" class="col-md-2">First name:</label> | |
<div class="col-md-10"> | |
<input type="text" name="first_name" id="first_name" class="form-control" value="<?php echo $_POST['first_name']; ?>" placeholder="First name" /> | |
</div> | |
</div> | |
<div class="row"> | |
<label for="last_name" class="col-md-2">Last name:</label> | |
<div class="col-md-10"> | |
<input type="text" name="last_name" id="last_name" class="form-control" value="<?php echo $_POST['last_name']; ?>" placeholder="Last name" /> | |
</div> | |
</div> | |
<div class="row"> | |
<div class="col-md-10 col-md-offset-2"> | |
<input type="submit" value="What is your name?" class="btn btn-primary" /> | |
</div> | |
</div> | |
</form> | |
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> | |
<!-- Include all compiled plugins (below), or include individual files as needed --> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment