The form problem is really wrong.

Source: Internet
Author: User
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

SetusernameTry 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.