I'm using Putty. I am trying to get $_ENV
to print to a table. I seem to be OK with $_SERVER
displaying, but everything I try with $_ENV
wont display. My code is :
<HTML><HEAD><TITLE>$_ENV</TITLE></HEAD>
<BODY>
<TABLE border="1">
<TR><TD><b>Keys</b><TD><b>Values</b>
<?php
while (list ($key, $value) = each($_ENV)) {
print ("<TR><TD>$key<TD>$value
");
}
?>
</TABLE>
</BODY></HTML>
The getenv("REMOTE_ADDR")
and print_r($_ENV)
will only give me the Remote Address. I want all keys and their variables. For $_SERVER
my code gives me all keys from a form that's submitted.
<?php
//If form not submitted, display form.
if (isset($_POST['submit']))
{
$msg = $_POST["msg"];
$name = $_POST["name"];
$posts = file_get_contents("posts.txt");
$posts = "$msg - $name
" . $posts;
file_put_contents("posts.txt", $posts);
echo $posts;
print"<table border=1>";
echo "<th>Keys</th> <th>My SERVER Info</th>";
foreach ($_SERVER as $key=>$val )
{
echo "<tr><td>".$key."</td><td>" .$val."</tr>";
}
print"</table>";