Källkod
Följande filer och mappar finns under mappen webbserverprogrammering.
Mappar visas till vänster och filer till höger. Klicka på en fil eller mapp för att öppna nedan eller visa dess innehåll.
webbserverprogrammering/exercises/forms/
15 filer
forms_1.html
forms_1.php
forms_2.html
forms_2.php
forms_3.html
forms_3.php
forms_4.html
forms_4.php
forms_5.html
forms_5.php
forms_6.html
forms_6.php
forms_7.html
forms_7.php
forms_8.php
forms_1.php
forms_2.html
forms_2.php
forms_3.html
forms_3.php
forms_4.html
forms_4.php
forms_5.html
forms_5.php
forms_6.html
forms_6.php
forms_7.html
forms_7.php
forms_8.php
forms_5.php
33 lines UTF-8 Windows (CRLF)
<?php
error_reporting(-1); // Report all type of errors
ini_set('display_errors', 1); // Display all errors
ini_set('output_buffering', 0); // Do not buffer outputs, write directly
?>
<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="utf-8">
<title>PHP-Formulär 5</title>
</head>
<body>
<?php
if (isset($_POST["sent"])) {
$firstname = $_POST["firstname"];
$surname = $_POST["surname"];
$class = $_POST["class"];
$food = $_POST["food"];
$schoolCourse = $_POST["schoolCourse"];
$output = "Hej $firstname $surname i $class! Du gillar $food! Din favoritkurs är $schoolCourse.";
echo $output;
$mail = mail("alrikmz@vgy.se", "Mejltestttttt", wordwrap($output, 68), "From: alrikmz@vgy.se \nReply-To: kalleanka@ankeborgstad.se");
if ($mail)
echo "<br><br><br>Mail skickat!";
else
echo "Mailskick misslyckat!";
} else {
echo "Gå till forms_5.html istället";
}
?>
</body>
</html>