Open JeroenHeemskerk opened 1 year ago
contact.html
contact.php
Mocht je er niet uitkomen, globaal ziet je contact.php er alsvolgt uit:
<doctype HTML>
<html><head>...</head><body> <?php
<html>
<head>...</head>
<body>
<?php
// initate the variables $name = $email = ... = $message = ''; $nameErr = $emailErr = ... = $messageErr = ''; $valid = false;
// initate the variables
$name = $email = ... = $message = '';
$nameErr = $emailErr = ... = $messageErr = '';
$valid = false;
if ($_SERVER['REQUEST_METHOD'] == 'POST') { // validate the 'POST' data
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// validate the 'POST' data
// ....
$valid = ... } ?>
$valid = ...
}
?>
<header> <h1>Contact</h1> </header>
<header>
<h1>Contact</h1>
</header>
<nav> <ul class='menu'> ... </ul> </nav>
<nav>
<ul class='menu'> ... </ul>
</nav>
<section>;
<?php if (!$valid) { /* Show the next part only when $valid is false */ ?>
<form method="POST" action="contact.php">; ... <input name="email" value="<?php echo $email; ?>" id="email"> <span class="error">* <?php echo $emailErr; ?></span> ... </form>;
<form method="POST" action="contact.php">;
...
<input name="email" value="<?php echo $email; ?>" id="email">
<span class="error">* <?php echo $emailErr; ?></span>
</form>;
<?php } else { /* Show the next part only when $valid is true */ ?>
<p>Bedankt voor uw reactie:</p> ... <div>Email: <?php echo $email; ?></div> ...
<p>Bedankt voor uw reactie:</p>
<div>Email: <?php echo $email; ?></div>
<?php } /* End of conditional showing */ ?>
</section>
<footer> .... </footer></body>
<footer> .... </footer>
</body>
contact.html
naarcontact.php
.Mocht je er niet uitkomen, globaal ziet je contact.php er alsvolgt uit:
// initate the variables
$name = $email = ... = $message = '';
$nameErr = $emailErr = ... = $messageErr = '';
$valid = false;
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// validate the 'POST' data
// ....
$valid = ...
}
?>
<header>
<h1>Contact</h1>
</header>
<nav>
<ul class='menu'> ... </ul>
</nav>
<section>;
<?php if (!$valid) { /* Show the next part only when $valid is false */ ?>
<form method="POST" action="contact.php">;
...
<input name="email" value="<?php echo $email; ?>" id="email">
<span class="error">* <?php echo $emailErr; ?></span>
...
</form>;
<?php } else { /* Show the next part only when $valid is true */ ?>
<p>Bedankt voor uw reactie:</p>
...
<div>Email: <?php echo $email; ?></div>
...
<?php } /* End of conditional showing */ ?>
</section>
<footer> .... </footer>
</body>