Newbie working with PHP 5.0, IIS, Win2000

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello everyone.  Hopefully someone can help me with this.

I was able to install PHP successfully.  I tried a sample script and it
worked fine through IE.  I then tried to create a script that would pass a
value on to another script using the post method.  These are called Pass.php
and Pass1.php.

Pass.php contains the following.
<form action="pass1.php" method="post">
    Name:  <input type="text" name="username" /><br />
    Email: <input type="text" name="email" /><br />
    <input type="submit" name="submit" value="Submit me!" />
</form>

Pass1.php contains the following.
<?php
// Available since PHP 4.1.0
   echo $_POST['username'];
   echo $_REQUEST['username'];
   import_request_variables('p', 'p_');
   echo $p_username;
// Available since PHP 3. As of PHP 5.0.0, these long predefined
// variables can be disabled with the register_long_arrays directive.
   echo $HTTP_POST_VARS['username'];
// Available if the PHP directive register_globals = on. As of
// PHP 4.2.0 the default value of register_globals = off.
// Using/relying on this method is not preferred.
   echo $username;
?>

This is the output I received from this.
CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:


PHP Notice:  Undefined index:  username in C:\Web\Pass1.php on line 4
PHP Notice:  Undefined index:  username in C:\Web\Pass1.php on line 5
PHP Notice:  Undefined variable:  p_username in C:\Web\Pass1.php on line 8
PHP Notice:  Undefined variable:  HTTP_POST_VARS in C:\Web\Pass1.php on line
13
PHP Notice:  Undefined variable:  username in C:\Web\Pass1.php on line 19
I then replaced Pass1.php with the following code to check for any data that
was being posted.// This will check for posted values
<?php
$empty = $post = array();
foreach ($_POST as $varname => $varvalue) {
   if (empty($varvalue)) {
       $empty[$varname] = $varvalue;
   } else {
       $post[$varname] = $varvalue;
   }
}
print "<pre>";
if (empty($empty)) {
   print "None of the POSTed values are empty, posted:\n";
   var_dump($post);
} else {
   print "We have " . count($empty) . " empty values\n";
   print "Posted:\n"; var_dump($post);
   print "Empty:\n";  var_dump($empty);
   exit;
}
?>
This supplied the following output.
CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:


// This will check for posted values
None of the POSTed values are empty, posted:
array(0) {
}
I would really appreciate if someone could help me figure out what is going
on.

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux