Why is the value of the session variable not being taken? How to fix it

Source: Internet
Author: User
Why is the value of the session variable not being taken?
The page that registers the session variable is written like this:
$username = $HTTP _post_vars["username"];
Session_register ("username");

On another page, judge this:
if (!isset ($_session["username") | | $_session["username"]== "")
{
Print ("Username unregistered!
");
Print ("Login
");
Die ();
}
else print ("username is registered!
");


$HTTP _post_vars["username"] already has the value, but in the judgment of the page printed out is username unregistered!, this is why?

PHP version is 4.3.9, is not the PHP configuration file to do what changes?

------Solution--------------------
Session_Start ();
$username = $HTTP _post_vars["username"];
$_session[' username '] = $username;
------Solution--------------------
Session_Start ()?
------Solution--------------------
$username = $HTTP _post_vars["username"];
Session_register ("username");

==>
$_session["username"]= $username;
------Solution--------------------
is not your PHP setup problem?

I also encountered the previous one, is the space business to restore a system, my session can not afford to use,

Nor is it completely useless, that is, when the front page is valid, the page is not available.

And then he set it up again.
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.