I am testing my page which has a very simple form:
<form action="script/check.php" method = "post">
<input type = "text" name = "email">
<input type = "submit">
</form>
When my check.php file has the following code, it works fine:
<?
var_dump($_POST);
?>
The output is array(1) { ["email"]=> string(5) "hello" }, as expected.
When check.php includes session_start(), $_POST becomes empty.
<?
session_start();
var_dump($_POST);
?>
The output is now array(0) { }.
It's difficult to search for this problem, unfortunately most of the results I find online with these search terms are about empty $_SESSION variables, which is not a problem for me. The problem is $_POST is empty.
There is a catch: $_POST goes through correctly when I test the page from a local machine, on the network where the server is stored. For everywhere else, this is not the case, the site is unworkable. This is extremely odd as I've been using scripts of this type for months without any problem, and outside users have been able to connect without issue. I'm thinking it's a directory permission problem, but I can't be sure without more information.
..had the same problem too. The reason for the empty $_SESSION-vars were the incorrect rights in the /var/lib/php/session directory: 755 owner + group the user which runs the http (apache, www-data or cherokee)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With