0

我基本上是在尝试从设置中获取提交的值,以便当用户提交它时,它会显示在 mainpage.php 上。这是我在 settings.php 中的代码...

<html>
<head><title></title></head>
<body>
<a href="logout.php">Logout</a>
<a href="mainpage.php">Main Page</a>

<form action="" method="get">
<b>Bio</b>
<br>
<textarea rows="5" cols="20" name="result" value="result"></textarea>
<br>
<input type="submit" value="Submit" name="bio">
</form>

<form action="" method="get">
<b>Hobbies</b>
<br>
<textarea rows="5" cols="20" name="result" value="result"></textarea>
<br>
<input type="submit" value="Submit" name="hobbies">
</form>

<form action="" method="get">
<b>Past School</b>
<br>
<textarea rows="5" cols="20" name="result" value="result"></textarea>
<br>
<input type="submit" value="Submit" name="school">
</form>

<form action="" method="get">
<b>Work History</b>
<br>
<textarea rows="5" cols="20" name="result" value="result"></textarea>
<br>
<input type="submit" value="Submit" name="work">
</form>

<form action="upload_file.php" method="post"
enctype="multipart/form-data">
<label for="file">Choose Profile Picture:</label>
<input type="file" name="file" id="file"> 
<input type="submit" name="pic" value="Submit">
</form>

</body>
</html>

这就是我的 mainpage.php

<?php

?>

<html>
<head><title></title></head>
<body>
<a href="logout.php">Logout</a>
<a href="settings.php">Settings</a>



</body>
</html>

有什么建议么?

4

1 回答 1

0

正如 Jenna R 所说,最好使用 POST,而不是 GET。

然后每个变量都被引用$_POST["name"]$_POST["result"]依此类推。

如果您这样做不是为了学习,我建议您开始阅读 PHP 并安全地提交表单。这是非常基本的,所以看起来你还没有打开手册或书。

于 2013-11-07T02:29:25.177 回答