Normally, the following two forms are submitted. form in php: {code ...} echo. output in php: echo $ _ POST [& #039; username & #039;]; {code ...} isn't the form written in this way? It's hard to figure it out .....??? I also use XAMMP and... to submit the following two files in an ordinary form:
Form in form. php:
Output in echo. php:
Echo $ _ POST ['username'];
Why do I always report this prompt: Notice: Undefined index: username in/Applications/XAMPP/xamppfiles/htdocs/form/echo. php on line 8?
Isn't the form written in this way? It's hard to figure it out .....???
I also use XAMMP and PhpStorm. Is it related to tools ??
Many of Baidu's websites are making judgments.
if(isset($_POST['username'])){ echo $_POST['username'];}
In this case, there is certainly no Notice, but there is no output data ..
Reply content:
It is an ordinary form that submits the following two files:
Form in form. php:
Output in echo. php:
Echo $ _ POST ['username'];
Why do I always report this prompt: Notice: Undefined index: username in/Applications/XAMPP/xamppfiles/htdocs/form/echo. php on line 8?
Isn't the form written in this way? It's hard to figure it out .....???
I also use XAMMP and PhpStorm. Is it related to tools ??
Many of Baidu's websites are making judgments.
if(isset($_POST['username'])){ echo $_POST['username'];}
In this case, there is certainly no Notice, but there is no output data ..
Set the enctype attribute of FORM.
Http://www.w3school.com.cn/tags/att_form_enctype.asp
Setusername
Try another word.
Are you sure you want to accept the php script echo. php?
The code is okay. I ran it again. I guess the possible reason is the php configuration problem. You need to add a few more inputs and Print $ _ POST on the receiving page, it is estimated that no post can be received. Try again with get.
Print $ _ POST directly to see which variables are received
Thanks for your answers. The problem has been solved. The problem is my access path. I accessed localhost: 63342/this port has accessed all the web servers in phpStorm and I have enabled Apache WebServer.
You only need to change the path to http: // localhost/form. php. Maybe kumfo has found the problem, but I don't know how to issue the file structure.