php $_POST array empty upon form submission

前端 未结 27 2650

I have a custom CMS i\'ve built that works perfectly on my dev box (Ubuntu/PHP5+/MySQL5+).

I just moved it up to the production box for my client and now all form su

相关标签:
27条回答
  • 2020-11-22 10:02

    OK, I thought that I should put my case here .... I was getting the post array empty in specific cases .. The form works well, but some times users complain that they hit submit button, and nothing happens ..... After digging for a while, I discovered that my hosting company has a security module that checks users inputs and clears the whole post array (not only the malicious data) if it discovers so. In my example, a math teacher was trying to enter the equation: dy + dx + 0 = 0; and data was wiped completely.

    To fix this, I just advise him now to enter the data in the text area as dy + dx + 0 = zero, and now it works .... This can save someone some time ..

    0 讨论(0)
  • 2020-11-22 10:04

    My problem was that I was using the HTML <base> tag to change the base URL of my test site. Once I removed that tag from the header, the $_POST data came back.

    0 讨论(0)
  • 2020-11-22 10:06

    Make sure that, in php.ini:

    • track_vars (it's only available on very old PHP versions) is set to On
    • variables_order contains the letter P
    • post_max_size is set to a reasonable value (e.g. 8 MB)
    • (if using suhosin patch) suhosin.post.max_vars and suhosin.request.max_vars are large enough.

    I suppose the second suggestion of mine will solve your problem.

    0 讨论(0)
  • 2020-11-22 10:06

    I've found that when posting from HTTP to HTTPS, the $_POST comes empty. This happened while testing the form, but took me a while until I realize that.

    0 讨论(0)
  • 2020-11-22 10:07

    Having the enable_post_data_reading setting disabled will cause this. According to the documentation:

    enable_post_data_reading

    Disabling this option causes $_POST and $_FILES not to be populated. The only way to read postdata will then 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.

    0 讨论(0)
  • 2020-11-22 10:08

    Make sure that the name property of each field is defined.

    This create you an empty POST on PHP

    <input type="text" id="Phone">
    

    But, this will work

    <input type="text" name="Phone" id="Phone">
    
    0 讨论(0)
提交回复
热议问题