新建一个PHP文件,然后再创建一个PHP文件,用于接受此页面输入的信息
时间: 2024-05-01 14:18:25 浏览: 13
这是一个关于编程的问题。你可以使用以下代码来接收页面输入的信息:
```
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
//收集表单数据
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
//打印输入的信息
echo "姓名: " . $name . "<br>";
echo "邮箱: " . $email . "<br>";
echo "信息: " . $message;
}
?>
```
然后,在另一个PHP文件中,你可以使用以下代码来向该页面发送POST请求并发送表单数据:
```
<form method="post" action="filename.php">
<label for="name">姓名:</label>
<input type="text" id="name" name="name"><br><br>
<label for="email">邮箱:</label>
<input type="text" id="email" name="email"><br><br>
<label for="message">信息:</label>
<textarea id="message" name="message"></textarea><br><br>
<input type="submit" value="提交">
</form>
```
希望这可以帮助你!
相关推荐
![pptx](https://img-home.csdnimg.cn/images/20210720083543.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![dll](https://img-home.csdnimg.cn/images/20210720083646.png)