Jump to content

Sessions


Recommended Posts

everytime I raed an article about sessions, I read it line by lne until I understanded as then at the end it says, this is no longer valid, do not use???session_register is deprecated$_SESSION['yadayada'] = "something I am storing"; is also no longer functional!!!!!!What is it that does work, How can I start a session and store the $myusername and $mypassword variables??

Link to post
Share on other sites

page1.php

some stuffif($count==1){session_start();$_SESSION['accountname'] = '$myusername';header("location:page2.php");}else{echo "Wrong Username or Password";}

page2.php

<? $myusername= $_SESSION['accountname'];echo "Hello ". $myusername; ?>

The output is onlyHelloWhat am i doing wrong?

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...