$_GET works, while $_POST does not

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mohitv
Forum Newbie
Posts: 3
Joined: Wed Mar 07, 2007 7:23 am

$_GET works, while $_POST does not

Post by mohitv »

Hello friends!
Could somebody help me with this...

I am using IIS 5.1 on win xp (sp2) machine with php 5.2.1.
While using $_POST array to pass values between normal html pages, no variables are passed i.e $_POST array is always blank.

However $_GET works. I was using php 5.2.1. I Tested a few different methods to get the values and on a few different codes.

However it did not help. I downloaded php 4.4.6, that too showed up the same problem. It seems that no variables are passed

using $_POST, while $_GET is working fine. I checked the resource and file upload settings in the php.ini file, they seemed

to be fine. Tried to print_r($_POST) and print_r($_GET) to print the arrays.
print_r($_POST) prints :Array ()
print_r($_GET) prints :Array ( [firstname] => ervin [LastName] => dorsan [email] => ervin@dorsan.com ) ie. data passed..

Do i need to download and try a different version of php, if yes, where could i get it?
Please do suggest any other methods to fix this?

Mohit Valecha
Please reply to : mohit.valecha@gmail.com
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Whats your <form> like ?
User avatar
mikeq
Forum Regular
Posts: 512
Joined: Fri May 03, 2002 3:33 am
Location: Edinburgh, Scotland

Post by mikeq »

in your html form, do your fields have a name attribute

i.e.

Code: Select all

<input type="text" name="myfield">
If not then that is your problem
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Post by jmut »

Read this first.

http://www.php.net/manual/en/tutorial.forms.php

Show sample code you have tried if still have problems.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Show the form method.

It should look like this...

Code: Select all

<form action="somepage.php" method="post">
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Doesn't sound like there is a form at all.
Post Reply