所以这里首先是 settings.php 的代码。
<html>
<head><title></title></head>
<body>
<a href="mainpage.php">Main Page</a>
<a href="tictactoe.php">Game</a>
<a href="logout.php">Logout</a>
<form action="mainpage.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
Bio: <input type="text" name="bio"><br>
Hobbies: <input type="text" name="hobbies"><br>
Past School: <input type="text" name="past"><br>
Work History: <input type="text" name="work"><br>
<input type="submit">
</form>
</body>
</html>
我正在尝试获取从该页面提交到 mainpage.php 的所有值以保存,以便当我单击另一个链接然后返回时,它仍然存在。这是我的 mainpage.php 的代码
<html>
<head><title></title></head>
<body>
<a href="settings.php">Settings</a>
<a href="tictactoe.php">Game</a>
<a href="logout.php">Logout</a>
</body>
</html>
<?php
if (!empty($_POST)){
$name = $_POST['name'];
$email = $_POST['email'];
$bio = $_POST['bio'];
$hobbies = $_POST['hobbies'];
$past = $_POST['past'];
$work = $_POST['work'];
echo "<br>";
echo "My name is: " . $name . "<br />";
echo "My email is: " . $email . "<br />";
echo "A bit about myself: " . $bio . "<br />";
echo "These are my hobbies: " . $hobbies . "<br />";
echo "These are past school: " . $past . "<br />";
echo "These are my past work: " . $work . "<br />";
}
?>
有什么建议么?