首页  >  问答  >  正文

PHP GET报错

<?php


教学网页:http://www.php.cn/code/1040.html#code_down_li


这行代码在phpstorm中一直报错:

C:\xampp\php\php.exe "D:\Yangsipeng\code\PS php CODE\reg.php"

PHP Notice:  Undefined index: username in D:\Yangsipeng\code\PS php CODE\reg.php on line 3
Notice: Undefined index: username in D:\Yangsipeng\code\PS php CODE\reg.php on line 3
PHP Notice:  Undefined index: pwd in D:\Yangsipeng\code\PS php CODE\reg.php on line 7
<br />
Notice: Undefined index: pwd in D:\Yangsipeng\code\PS php CODE\reg.php on line 7
<br />
Process finished with exit code 0
网页中打开也是一样的提示 html文件是按教学写的 两个文件也放在一起了


//$_GET后面加上中括号,将username作为字符串放在中括号里面,就得到了表单里面的<input type="text" name="username" /> 的值
$u = $_GET['username'];
echo $u.'<br />';

//$_GET['pwd'] 得到表单<input type="text" name="username" /> 的值
$passwd = $_GET['pwd'];
echo $passwd.'<br />';
?>

ShelbyShelby2067 天前1528

全部回复(2)我来回复

  • 韦小宝

    韦小宝2019-01-28 11:28:41

    Undefined index: username  你在PHP中直接打印一下  $_GET看看有没有username这个字段啊

    回复
    0
  • 取消回复