示例#1
0
<?php

include 'bouncer.php';
if ($_POST != null) {
    $bouncer = new Bouncer();
    $bouncer->checkGuestList($_POST['name']);
    $bouncer->checkAge($_POST['age']);
    // $alert[] = Bouncer::checkGuestList($_POST['name']);
    // $alert[] = Bouncer::checkAge($_POST['age']);
}
?>
<html>
<head>
	<meta charset="UTF-8">
	<title>The Club</title>
	<link rel="stylesheet" href="style.css">
</head>
<body>
	<div class="club-entrance">
		<h2>Welcome to THE CLUB</h2>
		<?php 
if (isset($bouncer->alert)) {
    foreach ($bouncer->alert as $message) {
        echo '<p class="alert">' . $message . '</p>';
    }
}
?>
		<form action="club.php" method="POST">
			<label for="name">Enter Name:</label>
			<input type="text" name="name">
			<label for="age">Enter Age:</label>
示例#2
0
<?php

include 'bouncer.php';
if ($_POST != null) {
    $alert[] = Bouncer::checkGuestList($_POST['name']);
    $alert[] = Bouncer::checkAge($_POST['age']);
}
?>
<html>
<head>
	<meta charset="UTF-8">
	<title>The Club</title>
	<link rel="stylesheet" href="style.css">
</head>
<body>
	<div class="club-entrance">
		<h2>Welcome to THE CLUB</h2>
		<?php 
foreach ($alert as $message) {
    echo '<p class="alert">' . $message . '</p>';
}
?>
		<form action="club.php" method="POST">
			<label for="name">Enter Name:</label>
			<input type="text" name="name">
			<label for="age">Enter Age:</label>
			<input type="text" name="age">
			<input type="submit" value="Guest Lookup">
		</form>
	</div>
</body>