|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
$_POST always empty
OS: Windows XP
PHP Version 5: Installation: I looked at all the settings recommended for the installation of PHP with IIS. Coding: I a simple two input html form (all text) that calls a PHP file. The $_POST is always empty. If I set $_POST equal to some text within the PHP file then it works fine. I have tried to test to see if $_POST is empty or not with the simple code of: <?php if (empty($_POST)) { echo "No data was submitted";} ?> I can extract data from an ODBC database with PHP - which, I believe, indicates that the PHP is working. Is there a problem with the PHP configuration on my computer or do I need to define something else in either the form or the PHP file? Thanks for your help. |
|
#2
|
||||
|
||||
|
RE: $_POST always empty
|
|
#3
|
|||
|
|||
|
RE: $_POST always empty
The format for my form was as you suggested.
I have now only included the following code: <?php print "Hello"; ?> When I run just the PHP file it works fine by displaying the word "Hello". However, when I call this PHP file from the HTML file with the form I receive a blank screen. |
|
#4
|
|||
|
|||
|
RE: $_POST always empty
You need to post your actual form code to get specific help with what it might or might not be doing.
|
|
#5
|
|||
|
|||
|
RE: $_POST always empty
form method="post" action="php/data_posting.php">
First Name: <input name="fname" type="text" size="35" /> Email: <input name="email" type="text" size="35" /> <input type="submit" value="submit" /> <input type="reset" /> I have deleted some text that asks the user to input the information. I have verified the html source code with the tool available from http://www.w3.org/. |
|
#6
|
||||
|
||||
|
RE: $_POST always empty
Could also post the PHP code, please?
|
|
#7
|
|||
|
|||
|
RE: $_POST always empty
I suspect that there is a permissions/script execution setting/doc_root setting that is not correct.
Your example has a file in a php folder - php/data_posting.php I suspect that your testing has your php files in the root folder and they execute, but when they are in this php/ folder they do not? |
|
#8
|
|||
|
|||
|
RE: $_POST always empty
Here is the latest code:
<?php print "Welcome"; ?> I also moved the php file into the root and it still displayed a blank page. |
|
#9
|
|||
|
|||
|
RE: $_POST always empty
I looked at the PHP.ini file and it has the following settings:
; The root of the PHP pages, used only if nonempty. ; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root ; if you are running php as a CGI under any web server (other than IIS) ; see documentation for security issues. The alternate is to use the ; cgi.force_redirect configuration below ;doc_root = ;user_dir = It is unclear whether these should have an explicit path under IIS. Also, **You CAN safely turn this off for IIS, in fact, you MUST.** ; cgi.force_redirect = 0 The Windows Environment Variables has a the PHP directoy for the exe file in it. |
|
#10
|
|||
|
|||
|
RE: $_POST always empty
I have a similar problem. When my page is submitted via POST, $_POST is empty, and REQUEST_METHOD is GET! I change the hosting service. Before the code runs fine with PHP 4.3.9, but it fails with PHP 4.4.4.
Tim |
|
#11
|
|||
|
|||
|
RE: $_POST always empty
Similar or Same? You would need to give specific details about the operating system (windows or other), web server (IIS or Apache or other) and post your form code and your form processing code.
There is no specific setting that prevents POST data from working, though things like register_globals can overwrite data if you have same names for POST/GET/SESSION variables. |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Installation > $_POST always empty |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|