Note that there are some explanatory texts on larger screens.

plurals
  1. POSession variables not set on header redirect
    primarykey
    data
    text
    <p>I'm having a problem where my session variables aren't getting set/saved.</p> <p>Here is my code:</p> <p>index.php has:</p> <pre><code>&lt;? //this is first line of page session_start(); ?&gt; &lt;form action="admin_process_login.php" method="post"&gt; &lt;p&gt;EMAIL&lt;/p&gt;&lt;input name="email" type="text"&gt; &lt;p&gt;PASSWORD&lt;/p&gt;&lt;input name="password" type="password" /&gt; &lt;input type="submit" value="Enter"&gt; &lt;/form&gt; </code></pre> <p>admin_process_login.php</p> <pre><code>&lt;? //this is first line of page session_start(); $useremail = $_POST['email']; $postpassword = $_POST['password']; include('admin_config.php'); if ($postpassword != "" &amp;&amp; $useremail != "") { //Connect to database mysql_connect("localhost", $dbusr, $dbpass) or die(mysql_error()); mysql_select_db("studioel_dental") or die(mysql_error()); //Look for a matching email/password $query = "SELECT * FROM users WHERE users.email = '$useremail' AND users.password = '$postpassword'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); if(mysql_num_rows($result)==0){ header("Location: http://www.dentalbenefitprogram.com/admin.php?error=nomatch"); } else { //set session variables and load supplies page $uid = $row['id']; $unamex = $row['name']; $uemailx = $row['email']; $utypex = $row['type']; $_SESSION['userid']=$uid; $_SESSION['uname']=$unamex; $_SESSION['uemail']=$uemailx; $_SESSION['utype']=$utypex; header("Location: http://www.dentalbenefitprogram.com/admin_groups.php"); exit; }; } else { //email or password fields were blank. Return to login page header("Location: http://www.dentalbenefitprogram.com/admin.php?error=blank"); }; ?&gt; </code></pre> <p>You can probably guess: the session variables aren't being set...</p> <p>Any help is appreciated greatly!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload