HTML FILE
<html>
<head>
</head>
<body>
<form action="http://localhost/cgi-bin/SimpleForm.php" method="post">
Name: <input type="text" name="username" /><br />
<input type="submit" name="submit" value="Submit me!" />
</form>
</body>
</html>
PHP SCRIPT
#!C:/php/php -q
<?php
header('Content-Type: text/html');
print "\n";
print "<br />\n";
$username_get = $GET['username'];
$username_post = $POST['username'];
$username_request = $_REQUEST['username'];
$username_http_get = $HTTP_GET_VARS['username'];
$username_http_postvars = $HTTP_POST_VARS['username'];
print "<br />username_get=$username_get\n";
print "<br />username_post=$username_post\n";
print "<br />username_request=$username_request\n";
print "<br />username_http_get=$username_http_get\n";
print "<br />username_http_postvars=$username_http_postvars\n";
?>
OUTPUT
<br />
<br />username_get=
<br />username_post=
<br />username_request=
<br />username_http_get=
<br />username_http_postvars=
NOTES
- The #! line is needed at the top of the php script or it gives a Internal Server Error. The C:\PHP directory is in the path environment variable so I don't know why. None of the php examples I have seen have this line.
- There are more variables than necessary because I have simply tried all the ones I have seen in various examples, as one does when desperate.
- The php print commands write to a file instead of the screen. I guess that's why it ignores the text/html and <br> tags.
I greatly appreciate any advice you can give. I have been struggling for two weeks. Have read all the tips I can find again and again, fixed various other problems along the way (such as as installing the much needed php5apache2_2.dll instead of the broken dll that most download sites give you). But I must be missing something simply too big to see. If I change SimpleForm.php to SimpleForm.pl it works. But I want to use PHP not Perl. Thanks a heap for any help.