PHP $ _ POST cannot accept data, but $ _ GET can accept data

Source: Internet
Author: User
For a newbie, the Code is as follows. It is okay to change post to get, but if it is post, it will prompt Notice: Undefinedindex: ainD: xampphtdocsmyphpadd.phponline3add.html {code ...} add. php {code ...} for a newbie, the Code is as follows. It is okay to change post to get, but if it is post, it will prompt
Notice: Undefined index: a in D: \ xampp \ htdocs \ myphp \ add. php on line 3

Add.html

    
      Title

Add. php

   
  

Reply content:

For a newbie, the Code is as follows. It is okay to change post to get, but if it is post, it will prompt
Notice: Undefined index: a in D: \ xampp \ htdocs \ myphp \ add. php on line 3

Add.html

    
      Title

Add. php

   
  

I am also a similar problem. There is only one possibility that the port configured by phpstrom does not match the phpinfo () port. Let's take a look. Phpinfo ()?> For example, localhost, configure phpstrom-> Tools-> Dployment-> Configuration->
Create a new file, such as Name = localhost, and set the Web sever root url to http: // localhost. The port must be consistent with the phpinfo () port.

Set enable_post_data_reading to On in php. ini to automatically enter the POST data in the $ _ POST array.

; Whether PHP will read the POST data.; This option is enabled by default.; Most likely, you won't want to disable this option globally. It causes $_POST; and $_FILES to always be empty; the only way you will be able to read the; POST data will be through the php://input stream wrapper. This can be useful; to proxy requests or to process the POST data in a memory efficient fashion.; http://php.net/enable-post-data-reading; enable_post_data_reading = Off

To determine whether to enter the values of a and B, use:

isset($_POST['a']) && isset($_POST['b']

When you input 0 values for a or B, the Branch is not added.

Print$_REQUESTArray,

If you check whether there is any data POST, we recommend that you print the data before processing the business.
You can directly
var_dump($_POST);
Check whether there is a value.

There are several methods to submit a post. How do you see it?

Php configuration problems

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.