Show sourcecode
The following files exists in this folder. Click to view.
public_html/exercises/formPostTest/
index.php
29 lines UTF-8 Windows (CRLF)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Elias Haglund är bajsikorv</title>
</head>
<body>
<form method="post" action="">
<label for="elias">Skriv ditt namn:</label><br>
<input type="text" name="elias">
<input type="submit" value="submit">
</form>
<?php
if (isset($_POST["elias"]) && $_POST["elias"] != "")
{
$elias = $_POST["elias"];
if($elias == "elias") {
echo '<h1>du är bajs</h1>';
}
else {
echo 'du heter '.$elias;
}
}
?>
</body>
</html>