Html5-php form submit get method can submit get value but post method can not get

Source: Internet
Author: User
Tags php form php form submit
Why does php form submission use the get method to submit and obtain values, but the post method cannot be obtained? Notice: Undefinedindex: abcinC: xampphtdocsphpstromhello is always displayed. phponline2; that is to say, the post method fails to pass the value, and the directory is in c: xam... why can I use the get Method for php form submission to obtain the value while the post method cannot? It is always displayed:
Notice: Undefined index: abc in C: \ xampp \ htdocs \ phpstrom \ hello. php on line 2;
That is to say, the post method fails to pass the value. The directory is under the c: xampp/htdocs directory.

POST method:
HTML source code:

    
      Document

PHP source code:


  

Reply content:

Why can I use the get Method for php form submission to obtain the value while the post method cannot? It is always displayed:
Notice: Undefined index: abc in C: \ xampp \ htdocs \ phpstrom \ hello. php on line 2;
That is to say, the post method fails to pass the value. The directory is under the c: xampp/htdocs directory.

POST method:
HTML source code:

    
      Document

PHP source code:


  

This is only a warning, not an error. Generally, the solution is $ abc = isset ($ _ POST ['abc'])? $ _ POST ['abc']: '';

Check the Request Method and test your code. No problem.


  

In fact, you can use

var_dump($_POST);

Print the content entered at the front end to see if the key value is included.abc

Isset ($ _ POST ['abc'])? $ _ POST ['abc']: '';

Form
If the method is post, $ _ POST ['name'] is used.
If the method is get, use $ _ GET ['name'].

Related Article

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.