Hi, all, I have a problem here.. for example in the first page - page1.php, i have a form. The form have LoginID and Pwd. when i click at the submit button, it will collect the LoginID and Pwd into the session variable.. then will link to page2.php. The problem i face now is i cannot get the session variable in page2.php.. below is my code. <?php session_start(); // start up your PHP session! $_SESSION['LoginID'] = $_REQUEST["LoginID"]; $_SESSION['Pwd'] = $_REQUEST["Pwd"]; ?> <form name="form1" action="page2.php" method="POST"> <table> <tr> <td>Login ID:</td><td><input name="LoginID" type="text" id="LoginID" size="20" </td> </tr> <tr> <td>Password:</td><td><input name="Pwd" type="text" id="Pwd" size="20" </td> </tr> <tr> <td><input name="submit" type="submit" id="submit" size="20" </td> </tr> </form> PHP: Then in the second page, page2.php i do this: <?php session_start(); echo $_SESSION[‘LoginID']; echo $_SESSION[‘Pwd']; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> </body> </html> PHP: but the session variable it got is empty.. anyone.. please help.. thank you in advance.
hello, you must make a registered session like as : $valid=$_REQUEST["LoginID"]; session_register('valid'); PHP: then you can called it : $_SESSION['valid'] PHP:
Actually, the problem is with this bit: <?php session_start(); echo $_SESSION[‘LoginID']; echo $_SESSION[‘Pwd']; ?> PHP: You're using a backtick ( ` ) instead of an apostrophe ( ' ). IE `LoginId' needs to be 'LoginId'