php $_POST array empty upon form submission

前端 未结 27 3356

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 09:45

    I came across a similar yet slightly different issue and it took 2 days to understand the issue.

    • In my case also POST array was empty.

    • Then checked with file_get_contents('php://input'); and that was also empty.

    Later I found that browser wasnt asking confirmation for resubmitting form data after If I refresh the page loaded after POST submission. It was directly refreshing page. But when I changed form URL to a different one it was passing POST properly and asked for resubmitting data when attempted to refresh page.

    Then I checked what is wrong with actual URL . There were no fault with URL, however it was pointing to a folder without index.php in URL and I was checking POST at index.php.

    Here I doubted the redirection from / to /index.php causes POST data to be lost and tested URL with appending index.php to the URL.

    That Worked.

    Posted it here so someone would find it helpful.

提交回复
热议问题