session variable passing problem... please help!!!
Posted: Thu Jun 19, 2003 7:30 pm
What I’m trying to get my code to do.
From page1.php! send a record number to page2.php ( rec_num) by click on one of the records displayed.
Page2.php starts up by displaying that record (rec_num). The user clicks the button “assigning incident to myself”. At this point it uses the record number (rec_num)sent from page1.php to modify the record(searches the db using the rec_num to modify the record). Then the same record is re-display, reflecting the change. Everything works if it isn’t within a session but if it’s within a session the record number isn’t visible to the button(s).
To view what I have a test db is setup:
http://www.comgen.ca/helpdesk/helpdesk.php
id: testing4
pwd: testpwd4 --> click "HD queue menu" -->select a record by clicking on the number to the left which displays the details of the record.
Select “assigning incident to myself” . this step should run other code and redisplay the same record but its failing at this point.
i copy/pasted some parts of the code for view and the only button that works right now to make things simple is "assign incident to myself button".
Need ideas to fix this issue.. been working on it for a week and getting nowhere..
Thanks everybody.
page1.php
page2.php
From page1.php! send a record number to page2.php ( rec_num) by click on one of the records displayed.
Page2.php starts up by displaying that record (rec_num). The user clicks the button “assigning incident to myself”. At this point it uses the record number (rec_num)sent from page1.php to modify the record(searches the db using the rec_num to modify the record). Then the same record is re-display, reflecting the change. Everything works if it isn’t within a session but if it’s within a session the record number isn’t visible to the button(s).
To view what I have a test db is setup:
http://www.comgen.ca/helpdesk/helpdesk.php
id: testing4
pwd: testpwd4 --> click "HD queue menu" -->select a record by clicking on the number to the left which displays the details of the record.
Select “assigning incident to myself” . this step should run other code and redisplay the same record but its failing at this point.
i copy/pasted some parts of the code for view and the only button that works right now to make things simple is "assign incident to myself button".
Need ideas to fix this issue.. been working on it for a week and getting nowhere..
Thanks everybody.
page1.php
Code: Select all
$change_color = 1;
while ($data=mysql_fetch_row($display_list))
{ list($rec_id, $rec_quickline, $rec_category, $rec_city)=$data;
if ($change_color == 1)
{ echo "
<tr class='myrow' bgcolor='#EEEEEE'>
<td width='11%' height='23'> <font size='5'> <span class='class1'> <a href='myquedetail.php?rec_num=".$rec_id."'>".$rec_id."</a> </span> </font></td>
<td width='47%' height='23'> <font size='4'> <span class='class1'> <a href='myquedetail.php?rec_num=".$rec_id."'>".$rec_quickline."</a> </span> </font></td>
<td width='31%' height='23'> <font size='4'> <span class='class1'> <a href='myquedetail.php?rec_num=".$rec_id."'>".$rec_category."</a> </span> </font></td>
<td width='11%' height='23'> <font size='4'> <span class='class1'> <a href='myquedetail.php?rec_num=".$rec_id."'>".$rec_city."</a> </span> </font></td>
</tr>";
$change_color=0;
}
else
{ // $cit = (empty( $rec_city)) ? 'N/A' : " $rec_city";
echo "
<tr class='myrow' bgcolor='#FFFFFF'>
<td width='11%' height='25'> <font size='5'> <span class='class1'> <a href='myquedetail.php?rec_num=".$rec_id."'>".$rec_id."</a> </span> </font></td>
<td width='47%' height='25'> <font size='4'> <span class='class1'> <a href='myquedetail.php?rec_num=".$rec_id."'>".$rec_quickline."</a> </span> </font></td>
<td width='31%' height='25'> <font size='4'> <span class='class1'> <a href='myquedetail.php?rec_num=".$rec_id."'>".$rec_category."</a> </span> </font></td>
<td width='11%' height='25'> <font size='4'> <span class='class1'> <a href='myquedetail.php?rec_num=".$rec_id."'>".$rec_city."</a> </span> </font></td>
</tr>";
$change_color = 1;
} //end of else statment
}//end of while statment
echo "</table>";Code: Select all
<?php
session_start();
//echo $id_search;
//header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
//header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
//header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
//header("Pragma: no-cache"); // HTTP/1.0
//header("Cache-control: private");
if (!session_is_registered("useridfield"))
{
//if session isn't registered this html message is displayed...
echo '<html>
<head>
<title> Access Denied </title>
</head>
<body>
<h1> Access Denied </h1>
<p>Your user ID or password is incorrect, or you are not a
registered user on this site. To try logging in again, click
<a href="pwdpage.php">here</a>. To register for instant
access, click <a href="create_acc.php">here</a>.</p>
</body>
</html>';
exit();
}
else
{
$record_number = $_GETї'rec_num'];
// database info
//session_register("cmd");
/*********************************************************************************/
if (!isset($_POSTї'Action'])) $_POSTї'Action'] = '';
if (!isset($_SESSIONї'FormProcessed'])) $_SESSIONї'FormProcessed'] = 0;
//***********send and take button controls*************************************
$localtime_date = date(" F d, Y g:i a",time() + (3 * 60 * 60));
$time_date_sent = "<BR> <HR>Incident/Request forwarded to HD at $localtime_date by consultent: $useridfield .";
$time_date_taken = "<BR> <HR>Incident/Request taken at $localtime_date by consultent: $useridfield";
//****************testing to blank in dbprob_owner **************************
mysql_connect($host, $user, $pwd);
@mysql_select_db($database) or die("Not able to connect to database");
$query2 = "select dbprob_fix from dbt_customer where dbcust_id = '$record_number'";
$results2 = mysql_query($query2) or die(mysql_error());
$row2 = mysql_fetch_array($results2);
mysql_close();
//****************testing blank in dbprob_owner **************************
// code to assigne call to yourself
/****************************************************/
/****************************************************/
/********problem area is with the button function********/
/********record number isn't received at this point**************/
/****************************************************/
if(isset($take_button))
{ mysql_connect($host, $user, $pwd);
@mysql_select_db($database) or die("Not able to connect to database");
$query1 ="update dbt_customer set dbprob_owner = '$useridfield' where dbcust_id = '$record_number'";
mysql_query($query1) or die(mysql_error());
mysql_close();
if (empty($row2ї'dbprob_fix']))
{ mysql_connect($name, $user, $pwd);
@mysql_select_db($database) or die("Not able to connect to database");
$querytime_date ="update dbt_customer1 set dbprob_fix = '$time_date_taken' where dbcust_id = '$record_number'";
mysql_query($querytime_date) or die(mysql_error());
mysql_close();
header("Location: http://www.comgen.ca/helpdesk/myquedetail.php");
exit();
}
else
{ mysql_connect($host, $user, $pwd);
@mysql_select_db($database) or die("Not able to connect to database");
$query1 = "update dbt_customer set dbprob_fix = concat(dbprob_fix, '$time_date_taken') where dbcust_id = '$record_number'";
mysql_query($query1) or die(mysql_error());
mysql_close();
$_SESSIONї'FormProcessed'] = 1;
header("Location: http://www.comgen.ca/helpdesk/myquedetail.php");
exit();
}
} //end of takent button
//*** code for the return button to send the call back to the helpdesk...
/*
/**************************************************************
//{// db opened and abstracted info to display
mysql_connect($host, $user, $pwd);
@mysql_select_db($database) or die("Not able to connect to database");
$query1 = "select dbcust_id, dbcust_fname, dbcust_lname, dbcust_street, dbcust_city, dbcust_prov_sta, dbpostal, dbcust_email, dbcust_phonenumber, dbprob_description, dbprob_category, dbprob_or_sys, dbprob_err_msg, dbprob_pc_info, dbprob_userfix, dbprob_date, dbprob_fix, dbprob_owner from dbt_customer where dbcust_id = '$record_number'";
$results1 = mysql_query($query1) or die(mysql_error());
$row = mysql_fetch_array($results1);
mysql_close();
$incidentnum_web = $rowї'dbcust_id'];
$username_web = $rowї'dbcust_fname'] ." ".$lname_web = $rowї'dbcust_lname'];
$street_web = $rowї'dbcust_street'];
$city_web = $rowї'dbcust_city'];
$province_web = $rowї'dbcust_prov_sta'];
$postal_web = $rowї'dbpostal'];
$email_web = $rowї'dbcust_email'];
$phone_web = $rowї'dbcust_phonenumber'];
$description_web = $rowї'dbprob_description'];
$category_web = $$rowї'dbprob_category'];
$opsys_web = $rowї'dbprob_or_sys'];
$errmsg_web = $rowї'dbprob_err_msg'];
$pcinfo_web = $rowї'dbprob_pc_info'];
$userfix_web = $rowї'dbprob_userfix'];
$probdate_web = $rowї'dbprob_date'];
$probfix_web = $rowї'dbprob_fix'];
$dbprobowner_web = $rowї'dbprob_owner'];
// ************************* wheather to disable button controls *************************/
// if statment that controls which button to disable.. if the call is taken the assigned to myself
// button is disabled and if not the send button is disabled
IF(!empty($dbprobowner_web))
{ $send_button = 'disabled';
}
else
{ $take_button = 'disabled';
$disable_close_call = 'disabled';}
//********************************************************************************************/
echo"<html>";
echo"<head>";
echo"<title>Incident/Report detail sheet</title>";
echo"</head>";
echo"<body onload='javascript:window.refresh();'>";
echo"<div align='center'>";
echo"<table width='800' border='0' align='center'>";
echo"<tr>";
echo"<td width='183'>$record_number</td>";
echo"<td width='364'><div align='center'><font color='#000000' size='6'>Incident/Report ",
"detail sheet </font></div></td>";
echo"<td width='239'><div align='right'>$useridfield</div></td>";
echo"</tr>";
echo"</table>";
echo"<hr>";
echo"<table width='800' border='0' align='center'>";
echo"<tr>";
echo"<td> </td>";
echo"</tr>";
echo"</table>";
echo '<table width="800" border="1" align="center" cellpadding="5" cellspacing="0">
<tr bordercolor="#6699CC" bgcolor="#6699CC">
<td width="87"><strong><font color="#FFFFFF"><a href="management1.php"><font color="#FFFFFF">Main
menu</font></a></strong></td>
<td width="79"><div align="center"><strong><a href="myqueue.php" target="_self"><font color="#FFFFFF">My
Queue</font></a></strong></div></td>
<td width="80"><div align="center"><strong><a href="hdqueue.php" target="_self"><font color="#FFFFFF">HD
Queue</font></a></strong></div></td>
<td width="55"><div align="center"><strong><a href="www.comgen.ca" target="_self"><font color="#FFFFFF">Email</font></a></strong></div></td>
<td width="77"><div align="center"><strong><a href="www.comgen.ca" target="_self"><font color="#FFFFFF">My
Profile</font></a></strong></div></td>
<td width="135"><div align="center"><strong><a href="www.comgen.ca" target="_self"><font color="#FFFFFF">Password
change</font></a></strong></div></td>
<td width="46"><div align="center"><strong><a href="www.comgen.ca"><font color="#FFFFFF">FAQs</font></a></strong></div></td>
<td width="70"><div align="center"><strong><a href="www.comgen.ca" target="_self"><font color="#FFFFFF">HD
Stats</font></a></strong></div></td>
<td width="61"><div align="center"><strong><a href="www.comgen.ca"><font color="#FFFFFF">Logout</font></a></strong></div></td>
</tr>
</table> ';
echo"<table width='800' border='0' align='center'>";
echo"<tr>";
echo"<td> </td>";
echo"</tr>";
echo"</table>";
echo "<table width='800' border='1' align='center' cellpadding='5' cellspacing='0'>";
echo "<tr>";
echo "<td width='800' bgcolor='#00CCCC'><strong>Information Centre</strong></td>";
echo "</tr>";
echo "<tr>";
echo "<td height='123'><table width='791' align='center'>";
echo "<tr>";
echo "<td width='106'><div align='right'><font size='2'><strong>Client Name:</strong></font></div></td>";
echo "<td width='270'><font size='2'>$username_web</font></td>";//first and last name field
echo "<td width='139'><div align='right'><strong><font size='2'>Incident/Report ",
"number:</font></strong></div></td>";
echo "<td width='256'><font size='2'>$incidentnum_web</font></td>"; //call number
echo "</tr>";
echo "<tr>";
echo "<td><div align='right'><font size='2'><strong>City:</strong></font></div></td>";
echo "<td><font size='2'>$city_web</font></td>"; //city
echo "<td><div align='right'><strong><font size='2'><strong>Date posted:</strong></font></strong></div></td>";
echo "<td><font size='2'>$probdate_web</font></td>"; //date
echo "</tr>";
echo "<tr>";
echo "<td><div align='right'><font size='2'><strong>Street:</strong></font></div></td>";
echo "<td>$street_web</td>"; //street
echo "<td><div align='right'><strong><font size='2'>Category:</font></strong></div></td>";
echo "<td>$category_web</td>"; //category
echo "</tr>";
echo "<tr>";
echo "<td height='21'><div align='right'><font size='2'><strong>Province:</strong></font></div></td>";
echo "<td><font size='2'>$province_web</font></td>"; //province
echo "<td><div align='right'><strong><font size='2'><strong>Operating system:</strong></font></strong></div></td>";
echo "<td>$opsys_web</td>"; //operating system
echo "</tr>";
echo "<tr>";
echo "<td height='29'><div align='right'><font size='2'><strong><font size='2'><strong><font size='2'>Contact ",
"number</font></strong>:</font></strong></font></div></td>";
echo "<td><font size='2'> $phone_web</font></td>"; //phone number
echo "<td><div align='right'><strong><font size='2'><strong><font size='2'>Email ",
"address</font></strong></font></strong></div></td>";
echo "<td>$email_web</td>"; //email
echo "</tr>";
echo "</table>";
echo "</td>";
echo "</tr>";
echo " </table>";
echo"<table width='800' border='0' align='center'>";
echo"<tr>";
echo"<td> </td>";
echo"</tr>";
echo"</table>";
echo"<table width='800' height='87' border='1' cellpadding='5' cellspacing='0'>";
echo"<tr>";
echo"<td height='23' bgcolor='#00CCCC'><strong>Incident/Request detail description</strong></td>";
echo"</tr>";
echo"<tr>";
echo"<td>$description_web</td>"; // problem description
echo"</tr>";
echo"</table>";
echo"<table width='800' border='0' align='center'>";
echo"<tr>";
echo"<td> </td>";
echo"</tr>";
echo"</table>";
echo"<table width='800' height='87' border='1' cellpadding='5' cellspacing='0'>";
echo"<tr> ";
echo"<td height='23' bgcolor='#00CCCC'><strong>Error message</strong></td>";
echo"</tr>";
echo"<tr>";
echo"<td>$errmsg_web</td>"; //error message
echo"</tr>";
echo"</table>";
echo"<table width='800' border='0' align='center'>";
echo"<tr>";
echo"<td> </td>";
echo"</tr>";
echo"</table>";
echo"<table width='800' height='87' border='1' cellpadding='5' cellspacing='0'>";
echo"<tr>";
echo"<td height='23' bgcolor='#00CCCC'><strong>Description of PC</strong></td>";
echo"</tr>";
echo"<tr>";
echo"<td>$pcinfo_web</td>"; //description of pc
echo"</tr>";
echo"</table>";
echo"<table width='800' border='0' align='center'>";
echo"<tr>";
echo"<td> </td>";
echo"</tr>";
echo"</table>";
echo"<table width='800' height='87' border='1' cellpadding='5' cellspacing='0'>";
echo"<tr>";
echo"<td height='23' bgcolor='#00CCCC'><strong>What the client did to fix the problem</strong></td>";
echo"</tr>";
echo"<tr>";
echo"<td>$userfix_web</td>"; //what the client did to fix the problme
echo"</tr>";
echo"</table>";
echo"<table width='800' border='0' align='center'>";
echo"<tr>";
echo"<td> </td>";
echo"</tr>";
echo"</table>";
echo"<table width='800' height='87' border='1' cellpadding='5' cellspacing='0'>";
echo"<tr>";
echo"<td height='23' bgcolor='#00CCCC'><strong>Suggestions and ideas for problem fix</strong></td>";
echo"</tr>";
echo"<tr>";
echo"<td>$probfix_web</td>"; //possible fix
echo"</tr>";
echo"</table>";
echo '<FORM NAME="ContactForm" ACTION="' . $_SERVERї'PHP_SELF'] . '" METHOD="POST">'; //form tag
echo"<table width='800' border='0' align='center' cellpadding='5' cellspacing='0'>";
echo"<tr>";
//echo"<td> </td>";
echo "<td><INPUT TYPE=HIDDEN NAME='Action' VALUE='Register'></td>";
echo"</tr>";
echo"</table>";
echo"<table width='800' height='151' border='1' cellpadding='5' cellspacing='0'>";
echo"<tr>";
echo"<td height='23' bgcolor='#00CCCC'><strong>Add to the suggestions and ideas ",
"for problem fix</strong></td>";
echo"</tr>";
echo"<tr>";
echo"<td height='120'>";
echo"<textarea name='actionline' cols='96' rows='10'></textarea>";
echo"</td>";
echo"</tr>";
echo"</table>";
echo"<table width='800' border='0' align='center'>";
echo"<tr>";
echo"<td> </td>";
echo"</tr>";
echo"</table>";
//*********************** Button controls********************************************/
echo "<table width='800' height='32' align='center'>";
echo "<tr>";
echo "<td width='214'> <div align='center'>", //assigne incident to myself button
"<input name='take_button' type='submit' value='Assign Incident to myself' $send_button>",
"</div></td>";
echo "<td width='221'><div align='center'>", // return to hd button
"<input name='return_button' type='submit' value='Return Incident to HD queue' $take_button>",
"</div></td>";
echo "<td width='175'> <div align='center'>", //form clear button
"<input name='resetform1' type='reset' value='Clear entery'>",
"</div></td>"; //append button
echo "<td width='170' height='26'> <div align='right'>",
"<input name='addactionline' type='submit' value='Append to suggestion'>",
"</div></td>";
echo "</tr>";
echo "</table>";
echo "<table width='800' border='0' align='center'>";
echo "<tr>";
echo "<td width='211'> <input name='closecallbutton' type='submit' value='Close Incident/Request ' $disable_close_call> </td>";
echo "<td width='579'><font color='#FF0000'>Once the Incident/Request is completed, ",
"update and close call.</font></td>";
echo "</tr>";
echo "</table>";
//*******************************************************************************************/
echo "</form>"; //end of button control / table
echo"<hr align='center'>";
echo"<table width='800' border='0' align='center'>";
echo"<tr>";
echo"<td> </td>";
echo"<td><div align='center'><font size='2'>www.comgen.ca</font></div></td>";
echo"<td> </td>";
echo"</tr>";
echo"</table>";
echo"</div>";
echo"</body>";
echo"</html>";
$_SESSIONї'FormProcessed'] = 0;
}
//}
?>