PHP:
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="nl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>voor jou</title>
</head>
<body>
<h1>Hallo <?php echo $nick; ?></h1>
<?php
if (empty($_POST) == false) {
$required_fields = array('voornaam');
foreach($_POST as $key=>$value) {
if (empty($value) && in_array($key, $required_fields) == true) {
$errors[] = 'Fields marked with an asterisk are required';
break 1;
}
}
if (preg_match("/\\s/", $_POST['voornaam'] == true)) {
$errors[] = 'Your username must not contain any spaces.';
}
}
if (isset($_GET['success']) == true) {
echo 'Hallo .';
} else {
if (empty($_POST) == false && empty($errors) == true) {
$nick = array(
'voornaam' => $_POST['voornaam']
);
register_user($nick);
header('Location: index.php?success');
exit();
} else if (empty($errors) == false) {
echo output_errors($errors);
}
?>
<form action="" method="post">
<ul id="naam">
<li>
Voornaam*:<br>
<input type="text" name="voornaam">
</li>
<li>
<input type="submit" value="verzenden">
</li>
</ul>
</form>
<?php
}
?>
</body>
</html>
Laatst bewerkt: