This commit is contained in:
louiscklaw
2025-01-31 19:15:17 +08:00
parent 09adae8c8e
commit 6c60a73f30
1546 changed files with 286918 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Lab06 Task2</title>
</head>
<body>
<?php
$myForm = <<<EOD
<form method="post" action="$_SERVER[PHP_SELF]">
<h1>Session Demo Page</h1>
<p>Programming language: <input type=text name=tfLang> will be stored in a session variable</p>
<button type=submit>Submit</button>
<button type=reset>Reset</button>
</form>
EOD;
if (isset($_POST['tfLang'])) {
session_start();
$_SESSION['lang'] = $_POST['tfLang'];
echo "\$_POST['tfLang'] = $_POST[tfLang] <br> \$_SESSION['lang'] = $_SESSION[lang]";
} else {
echo $myForm;
}
?>
</body>
</html>