Forums
This topic is locked
Passing Data between pages
Posted 03 May 2006 15:48:57
1
has voted
03 May 2006 15:48:57 Arson Fraud posted:
Hi,I am having a vexing problem, that I hope somebody here can solve! Before I tell you the problem, rest assured that I have tried every trick I know to solve the issue including: my own knowledge, the help of a friend, ALL of the relevant tech notes at Macromedia (none have worked), and searched DW forums.
Problem Description:
I have a query page that searches a table and then displays records, with a number of columns, on the same page (using repeat region and pagination). I am accomplishing this trick by using several proprietary MXP plug-ins. After the query has been run, I have put a link on one of the columns (last_name) to go to another page (detail.php) to display two additional columns from the table (ssn and cell_phone) in addition to the last_name column. I have tried using the HTTP_VARS method from Macromedia Tech notes, and instantiated SESSIONS with no luck ----I get NO echo on the output in the detail.php page!
What I would like:
1) I have attached my 1st page (search_apps.php) below.... assume that I know how to create links.....please help in providing me with the code I need to "capture" and make persistent the columns last_name, ssn, and cell_phone...
2) Assume that I have a second page detail.php.....what code do I need to "capture" the passed columns (last_name, ssn, and cell_phone) AND ECHO those fields on the page .....
Thanks for any help you can provide....
Jim E
<?php
//WA Database Search Include
require_once("WADbSearch/HelperPHP.php"
?>
<?php
//WA Database Search (Copyright 2005, WebAssist.com)
//Searchpage: search_apps.php;
//Form: form1;
$WADbSearch1_DefaultWhere = "";
if (!session_id()) session_start();
if ((isset($_POST["WADbSearch1"])) && ($_POST["WADbSearch1"] != "") {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1"
//keyword array declarations
//comparison list additions
$WADbSearch1->addComparisonFromList("session","sesh","AND","=",0);
$WADbSearch1->addComparisonFromList("hired_status","status","AND","=",0);
//save the query in a session variable
if (1 == 1) {
$_SESSION["WADbSearch1_search_apps"]=$WADbSearch1->whereClause;
}
}
else {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1"
//get the filter definition from a session variable
if (1 == 1) {
if (isset($_SESSION["WADbSearch1_search_apps"]) && $_SESSION["WADbSearch1_search_apps"] != "" {
$WADbSearch1->whereClause = $_SESSION["WADbSearch1_search_apps"];
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
$WADbSearch1->whereClause = str_replace("\\''", "''", $WADbSearch1->whereClause);
$WADbSearch1whereClause = $WADbSearch1->whereClause;
?>
<?php require_once('Connections/jobQuery.php'); ?>
<?php require_once('Connections/jobQuery.php'); ?>
<?php require_once('Connections/jobQuery.php'); ?>
<?php
$tfm_orderby =(!isset($HTTP_GET_VARS["tfm_orderby"]))?"serial_id":$HTTP_GET_VARS["tfm_orderby"];
$tfm_order =(!isset($HTTP_GET_VARS["tfm_order"]))?"ASC":$HTTP_GET_VARS["tfm_order"];
$sql_orderby = " " .$tfm_orderby." ".$tfm_order;
?>
<?php
$maxRows_applications = 10;
$pageNum_applications = 0;
if (isset($_GET['pageNum_applications'])) {
$pageNum_applications = $_GET['pageNum_applications'];
}
$startRow_applications = $pageNum_applications * $maxRows_applications;
$WADbSearch1whereClause_applications = "AND 0=0";
if (isset($WADbSearch1whereClause)) {
$WADbSearch1whereClause_applications = (get_magic_quotes_gpc()) ? $WADbSearch1whereClause : ($WADbSearch1whereClause);
}
$sqlorderby_applications = "serial_id";
if (isset($sql_orderby)) {
$sqlorderby_applications = (get_magic_quotes_gpc()) ? $sql_orderby : addslashes($sql_orderby);
}
mysql_select_db($database_jobQuery, $jobQuery);
$query_applications = sprintf("SELECT * FROM app_queries WHERE 0=0 %s ORDER BY %s", $WADbSearch1whereClause_applications,$sqlorderby_applications);
$query_limit_applications = sprintf("%s LIMIT %d, %d", $query_applications, $startRow_applications, $maxRows_applications);
$applications = mysql_query($query_limit_applications, $jobQuery) or die(mysql_error());
$row_applications = mysql_fetch_assoc($applications);
if (isset($_GET['totalRows_applications'])) {
$totalRows_applications = $_GET['totalRows_applications'];
} else {
$all_applications = mysql_query($query_applications);
$totalRows_applications = mysql_num_rows($all_applications);
}
$totalPages_applications = ceil($totalRows_applications/$maxRows_applications)-1;
mysql_select_db($database_jobQuery, $jobQuery);
$query_sessions = "SELECT * FROM `session` ORDER BY serial_id ASC";
$sessions = mysql_query($query_sessions, $jobQuery) or die(mysql_error());
$row_sessions = mysql_fetch_assoc($sessions);
$totalRows_sessions = mysql_num_rows($sessions);
mysql_select_db($database_jobQuery, $jobQuery);
$query_hiredstatus = "SELECT * FROM hired_status ORDER BY serial_id ASC";
$hiredstatus = mysql_query($query_hiredstatus, $jobQuery) or die(mysql_error());
$row_hiredstatus = mysql_fetch_assoc($hiredstatus);
$totalRows_hiredstatus = mysql_num_rows($hiredstatus);
mysql_select_db($database_jobQuery, $jobQuery);
$query_all_apps = "SELECT * FROM app_queries";
$all_apps = mysql_query($query_all_apps, $jobQuery) or die(mysql_error());
$row_all_apps = mysql_fetch_assoc($all_apps);
$totalRows_all_apps = mysql_num_rows($all_apps);
//Export to Excel Server Behavior
if (isset($_POST['excel'])&&($_POST['excel']=="excel"){
$output=" ";
$include_hdr="1";
if($include_hdr=="1"{
$totalColumns_all_apps=mysql_num_fields($all_apps);
for ($x=0; $x<$totalColumns_all_apps; $x++) {
if($x==$totalColumns_all_apps-1){$comma="";}else{$comma=",";}
$output = $output.(ereg_replace("_", " ",mysql_field_name($all_apps, $x))).$comma;
}
$output = $output."\r\n";
}
do{$fixcomma=array();
foreach($row_all_apps as $r){array_push($fixcomma,ereg_replace(",","¸",$r));}
$line = join(",",$fixcomma);
$line=ereg_replace("\r\n", " ",$line);
$line = "$line\n";
$output=$output.$line;}while($row_all_apps = mysql_fetch_assoc($all_apps));
header("Content-Type: application/xls"
header("Content-Disposition: attachment; filename=TEST.csv"
header("Content-Type: application/force-download"
header("Cache-Control: post-check=0, pre-check=0", false);
echo $output;
die();
}
//Export to Excel Server Behavior
if (isset($_POST['excel'])&&($_POST['excel']=="excel"){
$output=" ";
$include_hdr="1";
if($include_hdr=="1"{
$totalColumns_applications=mysql_num_fields($applications);
for ($x=0; $x<$totalColumns_applications; $x++) {
if($x==$totalColumns_applications-1){$comma="";}else{$comma=",";}
$output = $output.(ereg_replace("_", " ",mysql_field_name($applications, $x))).$comma;
}
$output = $output."\r\n";
}
do{$fixcomma=array();
foreach($row_applications as $r){array_push($fixcomma,ereg_replace(",","¸",$r));}
$line = join(",",$fixcomma);
$line=ereg_replace("\r\n", " ",$line);
$line = "$line\n";
$output=$output.$line;}while($row_applications = mysql_fetch_assoc($applications));
header("Content-Type: application/xls"
header("Content-Disposition: attachment; filename=report.csv"
header("Content-Type: application/force-download"
header("Cache-Control: post-check=0, pre-check=0", false);
echo $output;
die();
}
//Export to Excel Server Behavior
if (isset($_POST['excel'])&&($_POST['excel']=="excel"){
$output=" ";
$include_hdr="1";
if($include_hdr=="1"{
$totalColumns_applications=mysql_num_fields($applications);
for ($x=0; $x<$totalColumns_applications; $x++) {
if($x==$totalColumns_applications-1){$comma="";}else{$comma=",";}
$output = $output.(ereg_replace("_", " ",mysql_field_name($applications, $x))).$comma;
}
$output = $output."\r\n";
}
do{$fixcomma=array();
foreach($row_applications as $r){array_push($fixcomma,ereg_replace(",","¸",$r));}
$line = join(",",$fixcomma);
$line=ereg_replace("\r\n", " ",$line);
$line = "$line\n";
$output=$output.$line;}while($row_applications = mysql_fetch_assoc($applications));
header("Content-Type: application/xls"
header("Content-Disposition: attachment; filename=excel.csv"
header("Content-Type: application/force-download"
header("Cache-Control: post-check=0, pre-check=0", false);
echo $output;
die();
}
$queryString_applications = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_applications" == false &&
stristr($param, "totalRows_applications" == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_applications = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_applications = sprintf("&totalRows_applications=%d%s", $totalRows_applications, $queryString_applications);
$currentPage = $_SERVER["PHP_SELF"];
$queryString_apps = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_apps" == false &&
stristr($param, "totalRows_apps" == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_apps = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_apps = sprintf("&totalRows_apps=%d%s", $totalRows_apps, $queryString_apps);
$TFM_LimitLinksEndCount = 10;
$TFM_temp = $pageNum_apps + 1;
$TFM_startLink = max(1,$TFM_temp - intval($TFM_LimitLinksEndCount/2));
$TFM_temp = $TFM_startLink + $TFM_LimitLinksEndCount - 1;
$TFM_endLink = min($TFM_temp, $totalPages_apps + 1);
if($TFM_endLink != $TFM_temp) $TFM_startLink = max(1,$TFM_endLink - $TFM_LimitLinksEndCount + 1);
$queryString_apps = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_apps" == false &&
stristr($param, "totalRows_apps" == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_apps = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_apps = sprintf("&totalRows_apps=%d%s", $totalRows_apps, $queryString_apps);
?>
<?php
//sort column headers for applications
$tfm_saveParams = explode(",",""
$tfm_keepParams = "";
if($tfm_order == "ASC" {
$tfm_order = "DESC";
}else{
$tfm_order = "ASC";
};
while (list($key,$val) = each($tfm_saveParams)) {
if(isset($HTTP_GET_VARS[$val]))$tfm_keepParams .= ($val)."=".urlencode($HTTP_GET_VARS[$val])."&";
if(isset($HTTP_POST_VARS[$val]))$tfm_keepParams .= ($val)."=".urlencode($HTTP_POST_VARS[$val])."&";
}
$tfm_orderbyURL = $HTTP_SERVER_VARS["PHP_SELF"]."?".$tfm_keepParams."tfm_order=".$tfm_order."&tfm_orderby=";
?>
<?php require_once('Connections/jobQuery.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
#top_bkgrd {
position:absolute;
width:955px;
height:170px;
z-index:1;
top: 8px;
left: 8px;
visibility: visible;
}
#Layer1 {
position:absolute;
width:200px;
height:115px;
z-index:1;
}
#alc_logo {
position:absolute;
width:238px;
height:156px;
z-index:2;
left: 20px;
top: 14px;
visibility: visible;
}
#alc_text {
position:absolute;
width:615px;
height:41px;
z-index:3;
left: 306px;
top: 73px;
visibility: visible;
}
#nav_bar {
position:absolute;
width:602px;
height:30px;
z-index:4;
left: 309px;
top: 132px;
visibility: visible;
}
#side_bkgrd {
position:absolute;
width:150px;
height:404px;
z-index:5;
left: 8px;
top: 178px;
visibility: visible;
}
#search_instructions {
position:absolute;
width:143px;
height:24px;
z-index:6;
left: 12px;
top: 204px;
}
#footer {
position:absolute;
width:955px;
height:26px;
z-index:7;
left: 8px;
top: 583px;
visibility: visible;
}
#address_info {
position:absolute;
width:200px;
height:10px;
z-index:8;
left: 19px;
top: 592px;
visibility: visible;
}
#contact {
position:absolute;
width:129px;
height:15px;
z-index:9;
left: 830px;
top: 590px;
visibility: visible;
}
#Layer2 {
position:absolute;
width:746px;
height:405px;
z-index:10;
left: 220px;
top: 180px;
}
#Layer3 {
position:absolute;
width:200px;
height:115px;
z-index:10;
left: 311px;
top: 240px;
}
#Layer4 {
position:absolute;
width:1000px;
height:63px;
z-index:10;
left: 40px;
top: 80px;
}
#Layer5 {
position:absolute;
width:596px;
height:115px;
z-index:10;
left: 227px;
top: 183px;
}
#content {
position:absolute;
width:816px;
z-index:10;
left: 161px;
top: 182px;
visibility: visible;
font-family: "Times New Roman", Times, serif;
font-size: 10px;
height: 142px;
}
#Layer6 {
position:absolute;
width:200px;
height:115px;
z-index:10;
left: 271px;
top: 193px;
}
#Layer7 {
position:absolute;
width:200px;
height:115px;
z-index:10;
left: 388px;
top: 157px;
}
#Layer8 {
position:absolute;
width:804px;
height:231px;
z-index:10;
left: 221px;
top: 180px;
}
.style1 {font-size: 12px}
#Layer9 {
position:absolute;
width:163px;
height:75px;
z-index:11;
left: 1px;
top: 1px;
}
#Layer10 {
position:absolute;
width:200px;
height:115px;
z-index:11;
left: 188px;
top: 347px;
}
#Layer11 {
position:absolute;
width:200px;
height:115px;
z-index:11;
left: 185px;
top: 339px;
}
#excel {
position:absolute;
width:175px;
height:25px;
z-index:11;
left: 176px;
top: 187px;
visibility: visible;
}
.style2 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
}
#Layer12 {
position:absolute;
width:172px;
height:19px;
z-index:12;
left: 4px;
top: 43px;
}
-->
</style>
<script type="text/javascript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape"&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>
<body>
<div id="content">
<form name="form1" action="search_apps.php" method="post">
<div id="Layer12">Click to download all apps in .csv format</div>
<table border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td align="right"><label for="sesh">Select the correct session </label></td>
<td><select name="sesh">
<?php
do {
?>
<option value="<?php echo $row_sessions['session_db_name']?>"><?php echo $row_sessions['session_name']?></option>
<?php
} while ($row_sessions = mysql_fetch_assoc($sessions));
$rows = mysql_num_rows($sessions);
if($rows > 0) {
mysql_data_seek($sessions, 0);
$row_sessions = mysql_fetch_assoc($sessions);
}
?>
</select></td>
</tr>
<tr>
<td align="right"><label for="status">Select the correct hired status </label></td>
<td><select name="status">
<?php
do {
?>
<option value="<?php echo $row_hiredstatus['status']?>"><?php echo $row_hiredstatus['status']?></option>
<?php
} while ($row_hiredstatus = mysql_fetch_assoc($hiredstatus));
$rows = mysql_num_rows($hiredstatus);
if($rows > 0) {
mysql_data_seek($hiredstatus, 0);
$row_hiredstatus = mysql_fetch_assoc($hiredstatus);
}
?>
</select></td>
</tr>
<tr>
<td align="center" colspan="2"><input type="submit" name="WADbSearch1" value="Submit" /></td>
</tr>
</table>
<table width="812" border="1" cellspacing="0">
<tr>
<td width="103"><a href="<?Php echo ($tfm_orderbyURL); ?>first_name">First Name </a></td>
<td width="101"><a href="<?Php echo ($tfm_orderbyURL); ?>last_name">Last Name </a></td>
<td width="112"><a href="<?Php echo ($tfm_orderbyURL); ?>home_phone">Home Phone </a></td>
<td width="112"><a href="<?Php echo ($tfm_orderbyURL); ?>work_phone">Work Phone </a></td>
<td width="104"><a href="<?Php echo ($tfm_orderbyURL); ?>cell_phone">Cell Phone </a></td>
<td width="131"><a href="<?Php echo ($tfm_orderbyURL); ?>site_assignment1">Summer Site </a></td>
<td width="147"><a href="<?Php echo ($tfm_orderbyURL); ?>app_positionA">Position</a></td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_applications['first_name']; ?></td>
<td><?php echo $row_applications['last_name']; ?></td>
<td><?php echo $row_applications['home_phone']; ?></td>
<td><?php echo $row_applications['work_phone']; ?></td>
<td><?php echo $row_applications['cell_phone']; ?></td>
<td><?php echo $row_applications['site_assignment1']; ?></td>
<td><?php echo $row_applications['app_positionA']; ?></td>
</tr>
<?php } while ($row_applications = mysql_fetch_assoc($applications)); ?>
</table>
<p align="center" class="style1">
<?php
for ($i=0; $i <= $totalPages_applications; $i++) {
$TFM_PagesEndCount = $i + 1;
if($i != $pageNum_applications) {
printf('<a href="'."%s?pageNum_applications=%d%s", $currentPage, $i, $queryString_applications.'">'.$TFM_PagesEndCount."</a>"
}else{
echo("<strong>$TFM_PagesEndCount</strong>"
}
if($i != $totalPages_applications) echo("|"
}
?>
</p>
</form>
</div>
<div id="top_bkgrd"><img src="images/top_area.png" alt="Top Background" width="955" height="170" /></div>
<div id="alc_text"><img src="images/alc_text_head.png" alt="ALC Text Name" width="609" height="43" /></div>
<div id="alc_logo"><img src="images/alc_logo.gif" alt="ALC Logo" width="250" height="155" /></div>
<div id="nav_bar"><img src="images/nav_bar.png" alt="Navigation Bar" width="603" height="28" /></div>
<div id="side_bkgrd"><img src="images/left_area.png" alt="Side Background" width="150" height="405" /></div>
<div id="search_instructions"><img src="images/search_instructions.png" alt="ALC Search" width="143" height="26" /></div>
<div id="footer"><img src="images/footer.png" width="955" height="25" /></div>
<div id="address_info"><img src="images/alc_address.png" alt="Address" width="334" height="10" /></div>
<div id="contact"><img src="images/contact.png" alt="Contact" width="120" height="10" /></div>
<div id="excel">
<form action="" method="post" name="excel1">
<p>
<input name="excel" type="hidden" value="excel" />
<input name="download" type="submit" value="DOWNLOAD ALL APPS"/>
</form></div>
</body>
</html>
<?php
@mysql_free_result($applications);
@mysql_free_result($apps);
@mysql_free_result($sessions);
@mysql_free_result($hiredstatus);
@mysql_free_result($all_apps);
@mysql_free_result($preference);
@mysql_free_result($first_name);
?><b></b><b></b>