Jump to content


Photo

Standard POST variables not working on server


  • Please log in to reply
3 replies to this topic

#1 chrispols

chrispols
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 11 October 2006 - 12:30 PM

Hi,

I have PHP/Mysql running on my local server and everything works 100% I have now started running PHP on a windows 2003 IIS.
The issue I am having is with a standard POST display.
I have 2 files, test.php and test2.php. The following is what they contain:

Test.php:::

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name="form1" method="post" action="test2.php">
  <p>
    <input name="First_Name" type="text" id="First_Name">
  </p>
  <p>
    <input type="submit" name="Submit" value="Submit">
  </p>
</form>
</body>
</html>

Test2.php

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name="form1" method="post" action="">
  <p><?php echo $HTTP_POST_VARS['First_Name']; ?> the name</p>
  <p>&nbsp; </p>
</form>
</body>
</html>


On my machine, the Post_Vars works fine. On the IIS server, nothing comes up. It's blank. I can't figure out what is wrong with the setup.

Any ideas?

Thanks a lot,
Chris


#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 11 October 2006 - 01:02 PM

Use $_POST rather than $HTTP_POST_VARS

$HTTP_*_VARS are depreciated. You should use the newer superglobal arrays instead. Which are ($_GET, $_POST, $_COOKIE, $_SERVER, $_SESSION etc).

#3 chrispols

chrispols
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 11 October 2006 - 01:59 PM

Hey,
That works. So is this just something with IIS as on my Apache it works still with the old vars..

Thanks a lot!! Made my life tons easier

Chris

#4 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 11 October 2006 - 03:14 PM

No. Its to do with your PHP setup.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users