Hello, i just started gettng into php yesterday, and even bought a book entitled PHP and the WWW by Larry ullman, problem im having is making a simple form then passing the form contents through some vars to to php. Well ive been racking my brain all day over the stupid fact that i get a null var everytime i hit submit. Ive tried both the POST and GET methods and even $POST['var'] & $GET['var'] which the book doesnt even mention!
Ive double checked the code a thousand times and dont see a problem, unless the book is outdated which i doubt. This is leading me to believe this is a config error of some sort.
Here is what im using
PHP 4.2.2
Apache 2.4.20
RH9
And the code
<?php
echo "<html\n"
."<head>\n"
."<title>Upload an image</title>\n"
."</head>\n"
."<body>\n";
if ($file) {
print ("File name: $file_name<P>\n");
print ("File Size: $file_size<P>\n");
if (copy ($file, "/var/www/upload/$file_name")) {
print ("your file was successfully uploaded<P>\n");
} else {
print ("your file could not be copied<P>\n");
}
unlink($file);
}
print ("Upload a file to the server\n");
print ("<form action=\"index.php\" method=post enctype=\"multipart/form-data\">\n");
print ("File <input type=file name=\"file\" size=20<br>\n");
print (" <input type=submit name=\"submit\" value=\"upload\"></form>\n");
echo "</body>\n"
."</html>";
?>
Any Response would be apprecited!