Jump to content

Archived

This topic is now archived and is closed to further replies.

chrispols

Standard POST variables not working on server

Recommended Posts

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

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.