php - 我不断收到错误“警告:第 2 行 C:\xampp\htdocs\index.php 中未定义的数组键“用户名””,我不知道该怎么办
问题描述
<?php
$txt = $_POST['username'];
echo $txt;
?>
<!DOCTYPE html>
<html>
<body>
<form method="POST" action="index.php">
<input name="username">
<input type="submit">
</form>
</body>
我想要它做的是在提交表单时回显文本,但它所做的只是给我错误“警告:第 2 行 C:\xampp\htdocs\index.php 中的未定义数组键“用户名””。它也会在页面上显示该消息,因此非常烦人。
解决方案
推荐阅读
- php - PHP中带有用户IP地址的cURL请求
- scip - SCIP 节点选择器中的 std 优先级和 memsave 优先级
- vba - 替换范围文本然后插入一个符号
- c++ - 能够使用 Debug.Assert() 函数需要什么?
- android - 如何解决:从 network_security_config 解析 XML 配置失败
- linux - 如何订购具有特定标准的文本文件?
- javascript - 从不同的节点插件方法多次调用 JS 函数
- gradle - Gradle 如何:从依赖项中解压缩 ZIP 文件中的 ZIP 文件,并保持增量构建功能
- laravel - Laravel 5.8 带有参数、DI 和模拟的上下文绑定永远不会起作用
- bash - 如何在 shell 中创建自己的 bash 命令选项