search

Home  >  Q&A  >  body text

PHP GET error report

<?php


##Teaching web page:

http://www.php.cn/code/1040.html#code_down_li


This line of code keeps reporting errors in 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
The same prompt appears when opening the web page. The html file is written according to the instructions and the two files are also put together.



//$_GET Add square brackets after it, and put username as a string inside the square brackets, and you will get the value of <input type="text" name="username" /> in the form

$u = $_GET[ 'username'];
echo $u.'<br />';

//$_GET['pwd'] Get form<input type="text" name="username " The value of />
$passwd = $_GET['pwd'];
echo $passwd.'<br />';
?>

ShelbyShelby2150 days ago1584

reply all(2)I'll reply

  • 韦小宝

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

    Undefined index: username You can print it directly in PHP $_GET to see if there is a username field

    reply
    0
  • Cancelreply