|
$_SESSION problem with html page
i am working on a project that involves pulling variables from a mysql table, sticking them in a mysql_array, placing that said array into a $_SESSION, and then transferring said $_SESSION from one PHP page to another. The coding for this is as follows
Page 1:
[CODE]
<?php
$con = mysql_connect("localhost", "root", '');
if (!$con)
{
die('Cannot make a connection');
}
mysql_select_db('yumbox_table', $con) or die('Cannot make a connection');
session_start();
ini_set('session.bug_compat_warn', 0);
ini_set('session.bug_compat_42', 0);
$_SESSION['user_name'] = $_POST['user_name'];
$_SESSION['password'] = $_POST['password'];
$user_name = mysql_real_escape_string($_POST['user_na…
$password = mysql_real_escape_string($_POST['passwor…
$data = mysql_query("SELECT * from users where user_name = '$user_name' AND password = '$password'") or die(mysql_error());
$info = mysql_fetch_array($data);
$count = mysql_numrows($data);
if ($count==1)
{
if ($info['user_type']=('Support Staff'))
{
$support_data = mysql_query ("SELECT yumbox_customer_inquiry.customer_last_na… yumbox_customer_inquiry.customer_first_n… yumbox_customer_inquiry.customer_email, yumbox_customer_inquiry.problem_body, yumbox_customer_inquiry.problem_status, yumbox_customer_inquiry.problem_solution from yumbox_customer_inquiry, users where users.problem_id = yumbox_customer_inquiry.category_id");
$support_pull = mysql_fetch_array($support_data) or die(mysql_error());
while($support_pull = mysql_fetch_array($support_data))
{
if ($support_pull['problem_status'] = "unsolved")
{
echo "Customer Last Name: ". $support_pull['customer_last_name'];
echo "<br/>";
$_SESSION['customer_last_name']=$suppo…
echo "Customer First Name: ". $support_pull['customer_first_name'];
echo "<br/>";
$_SESSION['customer_first_name']=$supp…
echo "Customer E-Mail: ". $support_pull['customer_email'];
echo "<br/>";
$_SESSION['customer_email']=$support_p…
echo "Description of Problem: ". $support_pull['problem_body'];
echo "<br/>";
$_SESSION['problem_body']=$support_pul…
$_SESSION['problem_status']=$support_p…
print( '<a href="respond.html">Click here to resolve this issue</a>' );
}
}
}
if ($info['user_type']='Customer')
{
$customer_data = mysql_query ("SELECT yumbox_customer_inquiry.customer_last_na… yumbox_customer_inquiry.customer_first_n… yumbox_customer_inquiry.customer_email, yumbox_customer_inquiry.problem_body, yumbox_customer_inquiry.problem_status, yumbox_customer_inquiry.problem_solution from yumbox_customer_inquiry, users where users.email = yumbox_customer_inquiry.customer_email")…
$customer_pull = mysql_fetch_array($customer_data) or die(mysql_error());
while($customer_pull = mysql_fetch_array($customer_data))
{
$problem_solv = 1;
$problem_unsolv = 1;
if ($customer_pull['problem_status'] = "unsolved")
{
echo "HERE IS AN UNSOLVED TICKET";
echo $problem_num. ".";
echo "Description of Problem: ". $customer_pull[problem_body];
echo "<br/>";
++$problem_solv;
}
else
{
echo "HERE IS A RESOLVED TICKET:";
echo $problem_unsolv. ".";
echo "Description of Problem: ". $customer_pull[problem_body];
echo "<br/>";
echo "Given Solution: ". $customer_pull[problem_solution];
++$problem_unsolv;
}
}
print( '<a href="front_page.html">To submit a new customer support entry, click here</a>' );
}
}
else
{
echo ("I am sorry but this login is incorrect. Please try again");
}
mysql_close($con);
?>
[CODE]
Page 2:
[CODE]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<?php
session_start();
echo "Response to Customer Inquiry";
echo "Customer Last Name: ";
echo "</br>";
echo $_SESSION['customer_last_name'];
echo "Customer First Name: ";
echo "</br>";
echo $_SESSION['customer_first_name'];
echo "</br>";
echo "Description of Problem: ";
echo "</br>";
echo $_SESSION['problem_body'];
?>
[CODE]
Instead of displaying the variables stored in the $_SESSION superglobal, it displays the code you stored in your php file. Could someone please help me figure out why it does this?
|