cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Go to solution
New

php script has empty $_POST when processing a form

Hi:

Having a strange problem adding a form to a new web site I am building.

Using cpanel. Using all defaults for php. No php config  files.

My php script is called and executes when the form is submitted. I see the data in the post request message via firefox debugger. I added the following to my script to try and debug:

<?php

print "CONTENT_TYPE: " . $_SERVER['CONTENT_TYPE'] . "<BR />";
$data = file_get_contents('php://input');
print "DATA: <pre>";
var_dump($data);
var_dump($_POST);
print "</pre>";

echo("</br></br>");

 

echo(" Dumping Post <br/>");
foreach($_POST as $x => $x_value) {
echo "Key=" . $x . ", Value=" . $x_value;
echo "<br>";
}

echo(" Dumping Request <br/>");
foreach($_REQUEST as $x => $x_value) {
echo "Key=" . $x . ", Value=" . $x_value;
echo "<br>";
}

 

Note that I see my name=value strings from get file contents, but the _POST is empty

and the _REQUEST has only 2 srtrings that have "tcclvisitor" and "tcclvisit"...

Note that phpinfo shows all max values way larger than the couple hundred bytes of form data.

Something must be missing as the info is not being placed into the _POST or _REQUEST arrays..

Any ideas or suggestions would be welcomed.

 

2 REPLIES 2
Community Manager
Community Manager

Re: php script has empty $_POST when processing a form

Hi @jp42. Welcome to GoDaddy Community! To be honest, I'm way out of my depth in trying to answer your question. However, I did find something similar on Stack Overflow. Hopefully it helps. If not, others in the community may also be able to help. Hope you're able to get it figured out. 

 

JesseW - GoDaddy | Community Manager | 24/7 support available at x.co/247support | Remember to choose a solution and give kudos.
Highlighted
New
Solution

Re: php script has empty $_POST when processing a form

Thanks much. That was it. I thought I was safe in following an example, but the example I found had

enctype="text/plain" as one of the form keys, Seems this is simply not valid for a post.

Everything working fine now.