Empty php $_POST array

software development

#1

I have a very simple website in development using php and MySQL. The php code for inserting entries into the database via an html form and the $_POST variable works perfectly on my local development server. However when I upload it to the DreamHost server the $_POST array is empty.

This doesn’t seem like a code issue but more of a server configuration issue but I don’t know where to start looking. It doesn’t generate any errors while executing and the error log files are empty. Any suggestions on what the source of this issue might be?

Edit: I forgot to mention that the $_POST global variable does work. I use it to pass user authentication credentials for the login process. So maybe it is code related but I can’t figure why it would work on one server but not the other.


#2

I had the same problem attempting to POST from an iOS app. My problem was that I had set up the domain to “Add WWW” but didn’t have www. in the app’s URL. Changing that solved the problem. It turns out I could have also solved it by selecting “Leave it alone” instead of “Add WWW.”

Hope this helps you. BTW, in my case, tech support was quite generous with their time and extremely helpful.


#3

Thanks for the post Edward. In the end I believe that this was an issue with the framework that I chose to use. I found some other issues with the framework code or perhaps it was just how I was using it. I am not certain, as I am new to all this.

Ultimately I decided to start over using Laravel because it seems to be a much better framework and has vastly superior documentation. Thanks again for your assistance.