PHP Installation
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Installation

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old March 1st, 2007, 09:44 PM
Ian_Kiln Ian_Kiln is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 4 Ian_Kiln User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
$_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.

Reply With Quote
  #2  
Old March 1st, 2007, 11:21 PM
sliver's Avatar
sliver sliver is offline
Moderator
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: WI, USA
Posts: 932 sliver User rank is Private First Class (20 - 50 Reputation Level)sliver User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 11 h
Reputation Power: 3
Send a message via AIM to sliver Send a message via XFire to sliver
RE: $_POST always empty

In the form are you sure you're using method="post"? Like so:
php Code:
Original - php Code
  1.  
  2. <form action="handle.php" method="post">


If not, the default is $_GET and variables can be handled that way.

Reply With Quote
  #3  
Old March 1st, 2007, 11:45 PM
Ian_Kiln Ian_Kiln is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 4 Ian_Kiln User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.


Reply With Quote
  #4  
Old March 2nd, 2007, 12:33 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
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.

Reply With Quote
  #5  
Old March 2nd, 2007, 12:49 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
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/.


Reply With Quote
  #6  
Old March 2nd, 2007, 02:54 AM
sliver's Avatar
sliver sliver is offline
Moderator
Codewalkers Novice (500 - 999 posts)
 
Join Date: Apr 2007
Location: WI, USA
Posts: 932 sliver User rank is Private First Class (20 - 50 Reputation Level)sliver User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 11 h
Reputation Power: 3
Send a message via AIM to sliver Send a message via XFire to sliver
RE: $_POST always empty

Could also post the PHP code, please?

Reply With Quote
  #7  
Old March 2nd, 2007, 03:03 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
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?

Reply With Quote
  #8  
Old March 2nd, 2007, 03:21 AM
Ian_Kiln Ian_Kiln is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 4 Ian_Kiln User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #9  
Old March 2nd, 2007, 03:36 AM
Ian_Kiln Ian_Kiln is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 4 Ian_Kiln User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #10  
Old April 9th, 2007, 11:56 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
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

Reply With Quote
  #11  
Old April 11th, 2007, 12:07 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
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.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Installation > $_POST always empty


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek