p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Beginning PHP (http://p2p.wrox.com/forumdisplay.php?f=95)
-   -   Difficulty with $_SESSION (http://p2p.wrox.com/showthread.php?t=39229)

mall9@hotmail.com March 1st, 2006 02:04 PM

Difficulty with $_SESSION
 
Hello to everyone reading this.

I am a beginner to PHP, and i am experiencing a few problems with SESSIONS I have set up in a web site I am trying to develop.

My site requires users to login via a username and password, in which I have used session_start();, so I can use this information on the next page. I am incorporating this into all of my pages where I retrieve the username and display it in all the following page headings, welcoming that user to the new page.

Upon logging in, I ask the user to choose what they would like to do next, and all of my links carry over their details I request to their desired next page.

One of the option links requires the user to fill in all the fields. If they choose this and do not enter all the fields and try to submit it an error page is displayed, which I have created which again echoes the session information telling them there is an error. They can resume information entry at this point and submit the form.

Upon completing the form and submitting it, the user gets a confirmation message for a successful submission with the session information also being carried over. Eg Thank you Tim etc...

On this confirmation page, I ask the user if they would like to do the same thing again or go back to the homepage, where of course they choose the appropriate link.

MY PROBLEM OCCURS HERE: either link looses the session information, and I DON'T KNOW WHY! AHHHHHHHHHHHHHHHHHHHH:(.

I have one form, with all the code, which works perfectly until the links are used, at which point I loose all the session info which messes up everything, because the session information is vital.

The only way around it for me at the moment is the have the link redirect them to the login stage again, where of course the session information is re-invoked. That works for now, but it is inefficient!

If anyone can please help me, I would be very greatful.

Thank you.

H.

Gotaka4 March 6th, 2006 12:06 AM

Yo!
Hello everyone, i am back!!! been a while you know.

so mall9, two suggestions. go through this tutorial and carefully read and do it yourself. once you do that and still can't find your problem, post your codes and we'll see how it'll go from there

http://www.phpfreaks.com/tutorials/40/0.php



----------------
Never bother to learn something not knowing which does not do you any harm, and never neglect to learn something whose negligence will increase your ignorance - Imam Jafar Sadeq

mall9@hotmail.com March 9th, 2006 06:39 PM

Hello Gotaka4, thankyou for your reply. I had a look through the tutorial you sent me via the link, and i am still having problems. I think it's because of my inexperience of PHP which is the most annoying thing.

If you could take a look at my code and hopefully see the problem. Cheers.

---------------------------------------------
<?
session_start();
include "conn2.inc.php";
//Links to the helpdesk database
?>

<?
// I have used this code below, so I can retrieve some fields from the staff db,
//which i haven't used in the session, for example First_Name.

include "conn2.inc.php";
$query ="SELECT * FROM staff WHERE StaffID= '" . $_SESSION['staff_logged']."'
AND Password =(password('" . $_SESSION['staff_password'] . "'));";
$result = mysql_query($query) or die(mysql_error());
$new = mysql_fetch_array($result);
?>

<html>
<head>
<body background="h.gif">
<body>

<?
include "conn1.inc.php";


    if ($_POST['submit'] == "Submit")
    {
    if ($_POST['StaffID'] != "" && $_POST['Date'] != "" && $_POST['Time'] != "" &&
        $_POST['Location'] != "" && $_POST['DeviceID'] != "" && $_POST['Problem_Desc'] != "")

    {
    $user= $_POST['StaffID'];

    $q1 = "SELECT StaffID
               FROM fault_form
               WHERE StaffID = 'user';";

    $result = mysql_query($q1) or die(mysql_error());
    if (mysql_num_rows($result) != 0)
        {


?>
            <br>You have already made this request
            , <?php echo $_POST['StaffID']; ?>,
            Enter another!</b>

<?
include "conn1.inc.php";
?>

<FORM action="fault_form.php" method="post">

      <table border="5" cellpadding="1" cellspacing="2" align="center">

        <tr>
        <td bgcolor="">
          StaffID:
        </td>
        <td bgcolor="">
          <input type="text" name="StaffID" value="<? echo
            $_SESSION['staff_logged']; ?>"><br>
        </td>
        </tr>
        <tr>
        <td bgcolor="">
          Date:
        </td>
        <td bgcolor="">
          <input type="text" name="Date" value="<? echo
            $today = date("Y/m/d"); ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          Time:
        </td>
        <td bgcolor="">
          <input type="text" name="Time" value="<? print date("H:i:s"); ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          Location:
        </td>
        <td bgcolor="">
          <input type="text" name="Location" value="<? echo
            $_POST['Location']; ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          DeviceID:
        </td>
        <td bgcolor="">
          <input type="text" name="DeviceID" value="<? echo
            $_POST['DeviceID']; ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          Please enter brief description of problem<br>
          (250 Words Max):
        </td>
        <td bgcolor="">
          <textarea name="Problem_Desc" rows="2" cols="16" value="<?
          echo $_POST['Problem_Desc'];?>"></textarea><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="" colspan=2 align="center">
          <input type="submit" name="submit" value="Submit">
          <input type="reset" value="Clear">
        </td>
        </tr>
    </table

  </form>

//Updating the database

<?
    }
     else
    {

    $q8 = "INSERT INTO fault(StaffID, Date, Time, Location,
        DeviceID, Problem_Desc)
        VALUES ('" . $_POST['StaffID'] . "', '" . $_POST['Date'] ."',
        '" . $_POST['Time'] . "', '" . $_POST['Location'] ."',
        '" . $_POST['DeviceID'] . "', '". $_POST['Problem_Desc'] ."');";

        $result = mysql_query($q8) or die(mysql_error());
        $_SESSION['staff_logged'] = $_POST['staffID'];
        $_SESSION['staff_password'] = $_POST['password'];
?>


<br>
<div align="center"><h2>Confirmation.<br> <? echo $new['StaffID']; ?> Your Fault Was Submitted Successfully!</h2></div><br>
<div align="center"><h4>Thankyou for completing the Fault Reporting Form,<br> the fault reported will be looked at a.s.a.p<br>
<br>
Please check your account regularly for updates on your reported fault.<br><br>

To report another fault <a href="staff_homepage.php">Click Here</a>.<br><br>

To return to the Homepage <a href="logged_staff.php">Click Here</a>.<br>

<?

        }
    }
    else
    {
?>

<br>

    <b><div align="center"><h2><? echo $new['StaffID']; ?> You Have Encountered A Fault Error.<br>All Details Are Required!</h2>
    <h4>Check that your StaffID, Date, Time, Location, DeviceID <br> Problem Description
    of no more that 250 words has been entered!</h4></div></b><br>


<FORM action="fault_form.php" method="post">

      <table border="5" cellpadding="1" cellspacing="2" align="center">

        <tr>
        <td bgcolor="">
          StaffID:
        </td>
        <td bgcolor="">
          <input type="text" name="StaffID" value="<? echo
            $_SESSION['staff_logged']; ?>"><br>
        </td>
        </tr>
        <tr>
        <td bgcolor="">
          Date:
        </td>
        <td bgcolor="">
          <input type="text" name="Date" value="<? echo
            $today = date("Y/m/d"); ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          Time:
        </td>
        <td bgcolor="">
          <input type="text" name="Time" value="<? print date("H:i:s"); ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          Location:
        </td>
        <td bgcolor="">
          <input type="text" name="Location" value="<? echo
            $_POST['Location']; ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          DeviceID:
        </td>
        <td bgcolor="">
          <input type="text" name="DeviceID" value="<? echo
            $_POST['DeviceID']; ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          Please enter brief description of problem<br>
          (250 Words Max):
        </td>
        <td bgcolor="">
          <textarea name="Problem_Desc" rows="2" cols="16" value="<?
          echo $_POST['Problem_Desc'];?>"></textarea><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="" colspan=2 align="center">
          <input type="submit" name="submit" value="Submit">
          <input type="reset" value="Clear">
        </td>
        </tr>
    </table

  </form>

<?
    }
}
else
{

//First page of error/problem form
?>

<br>
<div align="center"><h2>Welcome <? echo $new['StaffID']; ?>,<br> To The Fault Reporting Page</h2></div>
<div align="center"><h4>Please Enter The Relevant Information Into The Fields Provided <br> & Press Submit</h4>
<br>

<FORM action="fault_form.php" method="post">

      <table border="5" cellpadding="1" cellspacing="2" align="center">

        <tr>
        <td bgcolor="">
          StaffID:
        </td>
        <td bgcolor="">
          <input type="text" name="StaffID" value="<? echo
            $_SESSION['staff_logged']; ?>"><br>
        </td>
        </tr>
        <tr>
        <td bgcolor="">
          Date:
        </td>
        <td bgcolor="">
          <input type="text" name="Date" value="<? echo
            $today = date("Y/m/d"); ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          Time:
        </td>
        <td bgcolor="">
          <input type="text" name="Time" value="<? print date("H:i:s"); ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          Location:
        </td>
        <td bgcolor="">
          <input type="text" name="Location" value="<? echo
            $_POST['Location']; ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          DeviceID:
        </td>
        <td bgcolor="">
          <input type="text" name="DeviceID" value="<? echo
            $_POST['DeviceID']; ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          Please enter brief description of problem<br>
          (250 Words Max):
        </td>
        <td bgcolor="">
          <textarea name="Problem_Desc" rows="2" cols="16" value="<?
          echo $_POST['Problem_Desc'];?>"></textarea><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="" colspan=2 align="center">
          <input type="submit" name="submit" value="Submit">
          <input type="reset" value="Clear">
        </td>
        </tr>
    </table

  </form>
<?
}
?>
</BODY>
</HTML>

------------------------------------------

That's it. Hope you have better luck than i do.

Hope to hear from you soon.

Thanks

H.



Gotaka4 March 9th, 2006 11:24 PM

are these all in one file or separate files? if so, please make clear.

----------------
Never bother to learn something not knowing which does not do you any harm, and never neglect to learn something whose negligence will increase your ignorance - Imam Jafar Sadeq

mall9@hotmail.com March 10th, 2006 04:28 AM

Yeah sorry, this is all one php file creating a single form. From the very bottom, that is my initail page to the user. If the user does not fill in all the relevant fields they get an error message, and a chance to fill in the form again. Upon a successful submission they get a confirmation page, with links to report another fault or return to the hompepage.

It works as it is meant to the very first time it is used, but once i click on either of the links : if you would like to report another fault OR return to the homepage link, all the session information is lost.

PLEASE NOTE: Even with the session information missing after clicking either link, if i want to report another fault, it works. It's just that the user has to type in their username etc, when before it would find it from the session information.

Any problems, just let me know.

Thanks

H.


Gotaka4 March 10th, 2006 11:53 AM

let's change these lines first:

$q1 = "SELECT StaffID
               FROM fault_form
               WHERE StaffID = 'user';";

to:

$ql = "SELECT StaffID FROM fault_form WHERE StaffID = '$user'";

try that and tell me what error you are getting exactly as it appears on your browser.

----------------
Never bother to learn something not knowing which does not do you any harm, and never neglect to learn something whose negligence will increase your ignorance - Imam Jafar Sadeq

mall9@hotmail.com March 10th, 2006 07:39 PM

Ok, I gave that a go, and it looked to make sense. Im not getting a syntax error from the php code, BUT i am getting the error message that i have already posted the exact same problem when i have not.

So it's outputing the code:


?>
            <br>You have already made this request
            , <?php echo $_POST['StaffID']; ?>,
            Enter another!</b>

<?
include "conn1.inc.php";
?>

<FORM action="fault_form.php" method="post">

      <table border="5" cellpadding="1" cellspacing="2" align="center">

        <tr>
        <td bgcolor="">
          StaffID:
        </td>
        <td bgcolor="">
          <input type="text" name="StaffID" value="<? echo
            $_SESSION['staff_logged']; ?>"><br>
        </td>
        </tr>
        <tr>
        <td bgcolor="">
          Date:
        </td>
        <td bgcolor="">
          <input type="text" name="Date" value="<? echo
            $today = date("Y/m/d"); ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          Time:
        </td>
        <td bgcolor="">
          <input type="text" name="Time" value="<? print date("H:i:s"); ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          Location:
        </td>
        <td bgcolor="">
          <input type="text" name="Location" value="<? echo
            $_POST['Location']; ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          DeviceID:
        </td>
        <td bgcolor="">
          <input type="text" name="DeviceID" value="<? echo
            $_POST['DeviceID']; ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          Please enter brief description of problem<br>
          (250 Words Max):
        </td>
        <td bgcolor="">
          <textarea name="Problem_Desc" rows="2" cols="16" value="<?
          echo $_POST['Problem_Desc'];?>"></textarea><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="" colspan=2 align="center">
          <input type="submit" name="submit" value="Submit">
          <input type="reset" value="Clear">
        </td>
        </tr>
    </table

  </form>

------------------------------------------

im also getting the //Updating the database message dispayed. Weird!

Hope this makes sense.

By the way, when you reply the next time, can you just state the time in 24 hour format so I know when it's best time to possibly respond to each other.

Thanks for the help

Appreciate it.

Hope to hear from you soon. [8D]


Mantis March 10th, 2006 08:44 PM

I have modified your code.

On my server, <? doesn't activate php ; I have to use <?php
also,
// text explication is for php
<!-- text explication --!> is for html
so be carrefull where you place them.

Last: session_start(); needs to placed at the top of every file you create otherwise it stop the session.

Hopefully that will work better.


<?php
session_start();
include "conn2.inc.php";
//Links to the helpdesk database
?>

<?php
// I have used this code below, so I can retrieve some fields from the staff db,
//which i haven't used in the session, for example First_Name.

include "conn2.inc.php";
$query ="SELECT * FROM staff WHERE StaffID= '" . $_SESSION['staff_logged']."'
AND Password =(password('" . $_SESSION['staff_password'] . "'));";
$result = mysql_query($query) or die(mysql_error());
$new = mysql_fetch_array($result);
?>

<html>
<head>
<body background="h.gif">
<body>

<?php
include "conn1.inc.php";


    if ($_POST['submit'] == "Submit")
    {
    if ($_POST['StaffID'] != "" && $_POST['Date'] != "" && $_POST['Time'] != "" &&
        $_POST['Location'] != "" && $_POST['DeviceID'] != "" && $_POST['Problem_Desc'] != "")

    {
    $user= $_POST['StaffID'];

    $q1 = "SELECT StaffID
               FROM fault_form
               WHERE StaffID = 'user';";

    $result = mysql_query($q1) or die(mysql_error());
    if (mysql_num_rows($result) != 0)
        {


?>
            <br>You have already made this request
            , <?php echo $_POST['StaffID']; ?>,
            Enter another!</b>

<?php
include "conn1.inc.php";
?>

<FORM action="fault_form.php" method="post">

      <table border="5" cellpadding="1" cellspacing="2" align="center">

        <tr>
        <td bgcolor="">
          StaffID:
        </td>
        <td bgcolor="">
          <input type="text" name="StaffID" value="<?php echo
            $_SESSION['staff_logged']; ?>"><br>
        </td>
        </tr>
        <tr>
        <td bgcolor="">
          Date:
        </td>
        <td bgcolor="">
          <input type="text" name="Date" value="<?php echo
            $today = date("Y/m/d"); ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          Time:
        </td>
        <td bgcolor="">
          <input type="text" name="Time" value="<?php print date("H:i:s"); ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          Location:
        </td>
        <td bgcolor="">
          <input type="text" name="Location" value="<?php echo
            $_POST['Location']; ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          DeviceID:
        </td>
        <td bgcolor="">
          <input type="text" name="DeviceID" value="<?php echo
            $_POST['DeviceID']; ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          Please enter brief description of problem<br>
          (250 Words Max):
        </td>
        <td bgcolor="">
          <textarea name="Problem_Desc" rows="2" cols="16" value="<?php
          echo $_POST['Problem_Desc'];?>"></textarea><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="" colspan=2 align="center">
          <input type="submit" name="submit" value="Submit">
          <input type="reset" value="Clear">
        </td>
        </tr>
    </table

  </form>

<!-- Updating the database --!>

<?php
    }
     else
    {

    $q8 = "INSERT INTO fault(StaffID, Date, Time, Location,
        DeviceID, Problem_Desc)
        VALUES ('" . $_POST['StaffID'] . "', '" . $_POST['Date'] ."',
        '" . $_POST['Time'] . "', '" . $_POST['Location'] ."',
        '" . $_POST['DeviceID'] . "', '". $_POST['Problem_Desc'] ."');";

        $result = mysql_query($q8) or die(mysql_error());
        $_SESSION['staff_logged'] = $_POST['staffID'];
        $_SESSION['staff_password'] = $_POST['password'];
?>


<br>
<div align="center"><h2>Confirmation.<br> <? echo $new['StaffID']; ?> Your Fault Was Submitted Successfully!</h2></div><br>
<div align="center"><h4>Thankyou for completing the Fault Reporting Form,<br> the fault reported will be looked at

a.s.a.p<br>
<br>
Please check your account regularly for updates on your reported fault.<br><br>

To report another fault <a href="staff_homepage.php">Click Here</a>.<br><br>

To return to the Homepage <a href="logged_staff.php">Click Here</a>.<br>

<?php

        }
    }
    else
    {
?>

<br>

    <b><div align="center"><h2><? echo $new['StaffID']; ?> You Have Encountered A Fault Error.<br>All

Details Are Required!</h2>
    <h4>Check that your StaffID, Date, Time, Location, DeviceID <br> Problem Description
    of no more that 250 words has been entered!</h4></div></b><br>


<FORM action="fault_form.php" method="post">

      <table border="5" cellpadding="1" cellspacing="2" align="center">

        <tr>
        <td bgcolor="">
          StaffID:
        </td>
        <td bgcolor="">
          <input type="text" name="StaffID" value="<?php echo
            $_SESSION['staff_logged']; ?>"><br>
        </td>
        </tr>
        <tr>
        <td bgcolor="">
          Date:
        </td>
        <td bgcolor="">
          <input type="text" name="Date" value="<?php echo
            $today = date("Y/m/d"); ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          Time:
        </td>
        <td bgcolor="">
          <input type="text" name="Time" value="<?php print date("H:i:s"); ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          Location:
        </td>
        <td bgcolor="">
          <input type="text" name="Location" value="<?php echo
            $_POST['Location']; ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          DeviceID:
        </td>
        <td bgcolor="">
          <input type="text" name="DeviceID" value="<?php echo
            $_POST['DeviceID']; ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          Please enter brief description of problem<br>
          (250 Words Max):
        </td>
        <td bgcolor="">
          <textarea name="Problem_Desc" rows="2" cols="16" value="<?php
          echo $_POST['Problem_Desc'];?>"></textarea><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="" colspan=2 align="center">
          <input type="submit" name="submit" value="Submit">
          <input type="reset" value="Clear">
        </td>
        </tr>
    </table

  </form>

<?php
    }
}
else
{

//First page of error/problem form
?>

<br>
<div align="center"><h2>Welcome <? echo $new['StaffID']; ?>,<br> To The Fault Reporting Page</h2></div>
<div align="center"><h4>Please Enter The Relevant Information Into The Fields Provided <br> & Press Submit</h4>
<br>

<FORM action="fault_form.php" method="post">

      <table border="5" cellpadding="1" cellspacing="2" align="center">

        <tr>
        <td bgcolor="">
          StaffID:
        </td>
        <td bgcolor="">
          <input type="text" name="StaffID" value="<?php echo
            $_SESSION['staff_logged']; ?>"><br>
        </td>
        </tr>
        <tr>
        <td bgcolor="">
          Date:
        </td>
        <td bgcolor="">
          <input type="text" name="Date" value="<?php echo
            $today = date("Y/m/d"); ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          Time:
        </td>
        <td bgcolor="">
          <input type="text" name="Time" value="<?php print date("H:i:s"); ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          Location:
        </td>
        <td bgcolor="">
          <input type="text" name="Location" value="<?php echo
            $_POST['Location']; ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          DeviceID:
        </td>
        <td bgcolor="">
          <input type="text" name="DeviceID" value="<?php echo
            $_POST['DeviceID']; ?>"><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="">
          Please enter brief description of problem<br>
          (250 Words Max):
        </td>
        <td bgcolor="">
          <textarea name="Problem_Desc" rows="2" cols="16" value="<?php
          echo $_POST['Problem_Desc'];?>"></textarea><br>
        </td>
        </tr>

        <tr>
        <td bgcolor="" colspan=2 align="center">
          <input type="submit" name="submit" value="Submit">
          <input type="reset" value="Clear">
        </td>
        </tr>
    </table

  </form>
<?php
}
?>
</BODY>
</HTML>

mall9@hotmail.com March 10th, 2006 09:20 PM

Thanks Mantis for your helpful tips with the commenting. I learnt something new there. :)

As for the session, well i have set the session to start on all of my pages, and my problem only occurs at this stage on my site. When the confirmation message is displayed and brings up the links, somehow the information is lost at this stage.

The confirmation message carries over session information, but as soon as either of my links are used, the session information is lost.

My initial thoughts were, you can't pass a session through one form more than once, but im not sure if that is true. Unless there is an explanation with sessions and links being combined together. To be honest im totally lost at this point seeing as all my other session work perfectly.

Im sure the answer is out there somewhere.

Thanks again for your reply.

H.


Mantis March 11th, 2006 06:30 AM

Perso I won't use the $_SESSION['variable'] as a "variable carrier" - I had issue where PHP wouldn't return the variable in the past until I refresh the page..

What I do is assign the session variable to a variable just below the session start.

$staff_logged=$_SESSION['staff_logged'];

also looking at the code,
$q8 = "INSERT INTO fault(StaffID, Date, Time, Location, DeviceID, Problem_Desc)
        VALUES ('" . $_POST['StaffID'] . "', '" . $_POST['Date'] ."',
        '" . $_POST['Time'] . "', '" . $_POST['Location'] ."',
        '" . $_POST['DeviceID'] . "', '". $_POST['Problem_Desc'] ."');";

        $result = mysql_query($q8) or die(mysql_error());
        $_SESSION['staff_logged'] = $_POST['staffID'];
        $_SESSION['staff_password'] = $_POST['password'];

Try instead:
$_SESSION['staff_logged'] = $_POST['staffID'];
$_SESSION['staff_password'] = $_POST['password'];
$staff_logged = $_POST['staffID'];
$staff_password = $_POST['password'];

And modify your code; replace all the $_SESSION['staff_logged'] and $_SESSION['staff_password'] by $staff_logged and $staff_password.

On the next page $staff_logged=$_SESSION['staff_logged']; and $staff_password=$_SESSION['staff_password'];

Give that a try


All times are GMT -4. The time now is 05:35 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.