hello,
I am using the examples in the book:
PHP: Your Visual Blueprint For Creating Open Source, Server Side Content
In the section where they talk about getting values from a form
submission, the book says:
"PHP makes it easy to process data from a form. When a PHP
page receives form information, the page automatically converts
the names of form elements to PHP variables, and assigns
the data entered in the elements to the variables"
So I try to display what was submitted, but I get an undefined
variable error.
For example,
<? php
print "the ID you entered was: ";
print $userid;
?>
This returns an error. But, if I use the following it works:
<? php
print "the ID you entered was: ";
print $HTTP_POST_VARS['userid'];
?>
Can someone explain this?
One more example:
I'm trying to simply display a session ID (using the example in the book):
<?php
session_start();
?>
<html>
<head>
<title>PHP Session Test</title>
</head>
<body>
<?php
print "The session ID is: ";
print $PHPSESSID;
?>
</body>
</html>
When I access this page I get:
The session ID is:
Notice: Undefined variable: PHPSESSID in c:\inetpub\wwwroot\sessiontest.php
on line 13
Why do I get this error? This is the exact example from the book.
Thanks for your help.