Hi,
i m new with php programming... I m working on one form in which i have created filter options for filter dynamic table content by completed, approve and rejected status....
but problem is when i m selecting any filtered option using select list data is displayed... but when i m clicking on next button in paging... dynamic table showing blank... same slect list getting blank.... anyone will help me...?
code of php file
<?php require_once('../Connections/localhost.php'); ?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "client";
$MM_donotCheckaccess = "false";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && false) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "../index.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
$MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_Recordset1 = 30;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
$myID = $_SESSION['MM_Username'];
$mystatus=$_GET['status'];
switch ($options)
{
case "All";
$All="selected";
break;
case "Completed";
$Completed="selected";
break;
case"Rejected";
$Rejected="selected";
break;
case"Pending";
$Pending="selected";
break;
}
$mystatus=$_POST['status'];
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
//databse queary for filters
$query_Recordset1 = "SELECT username, Jobid, Market, General_10, Entry_Points, Dept_Points, General_Points, Total_Points FROM form_gf ";
if($mystatus !=='All'){
$query_Recordset1 .= "WHERE status = '$mystatus'";}
else {
$query_Recordset1 .= "ORDER BY form_gf.Jobid";}
mysql_select_db($database_localhost, $localhost);
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $localhost) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
mysql_select_db($database_localhost, $localhost);
$query_status = "SELECT dropdown.options FROM dropdown WHERE dropdown.dropdownname = 'status'";
$status = mysql_query($query_status, $localhost) or die(mysql_error());
$row_status = mysql_fetch_assoc($status);
$totalRows_status = mysql_num_rows($status);mysql_select_db($database_localhost, $localhost);
$query_status = "SELECT options FROM dropdown WHERE dropdownname = 'status' ORDER BY options ASC";
$status = mysql_query($query_status, $localhost) or die(mysql_error());
$row_status = mysql_fetch_assoc($status);
$totalRows_status = mysql_num_rows($status);
$queryString_Recordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Recordset1") == false &&
stristr($param, "totalRows_Recordset1") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Brakedown Report</title>
<link href="../template.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../Menu/js/jquery.js"></script>
<script type="text/javascript" src="../Menu/js/interface.js"></script>
<script type="text/javascript" src="../Menu/js/fisheye_patched.js"></script>
<!--[if lt IE 7]>
<style type="text/css">
.dock img { behavior: url(iepngfix.htc) }
</style>
<![endif]-->
<link href="../Menu/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.Header { font-family: "Segoe UI";
font-size: 12px;
font-weight: 500;
color: #CCC;}
.table {
font-family: "Segoe UI";
font-size: 10pt;
border: 1px solid #000;
}
.text {
font-family: "Segoe UI";
font-size: 10pt;
}
a {
font-family: "Segoe UI";
font-size: 12px;
color: #333;
font-weight: bold;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #333;
}
a:hover {
text-decoration: none;
color: #36F;
}
a:active {
text-decoration: none;
color: #333;
}
</style>
</head>
<body>
<!--Wrapper Start-->
<div id="wrapper">
<!--Header Start-->
<div id="header">
<div id="logo"><img src="../images/logo.png" alt="isnlogo" width="64" height="30" align="middle" longdesc="http://www.isngs.com" /></div>
<div id="userinfo">
<table width="180" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td width="27" height="34"><img src="../images/user.png" width="26" height="30" alt="user" /></td>
<td width="77">Sagar Dhande</td>
<td width="26"><img src="../images/arrow.png" width="26" height="30" alt="arrow" /></td>
</tr>
</table>
</div>
<div id="status"></div>
</div>
<!--Header end-->
<div id="content">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr align="center">
<td width="99%"> <div id="dash3">
<div id="dash3_grid_head">Total Reccords </div>
<div id="dash3_grid_cont_back"><br />
<table width="890" border="0" align="center" cellpadding="0" cellspacing="0" class="table">
<tr class="Header"><form action="" method="post">
<td height="55" colspan="3" align="center" valign="middle" id="filters">Filter By Status</td>
<td align="left" valign="middle"><select name="status" id="status2" onchange="document.forms[0].submit();">
<option value="" <?php if (!(strcmp("", $mystatus))) {echo "selected=\"selected\"";} ?>></option>
<?php
do {
?>
<option value="<?php echo $row_status['options']?>"<?php if (!(strcmp($row_status['options'], $mystatus))) {echo "selected=\"selected\"";} ?>><?php echo $row_status['options']?></option>
<?php
} while ($row_status = mysql_fetch_assoc($status));
$rows = mysql_num_rows($status);
if($rows > 0) {
mysql_data_seek($status, 0);
$row_status = mysql_fetch_assoc($status);
}
?>
</select></td>
<td align="left" valign="bottom"><a href="excel.php"></a></td>
<td align="left" valign="bottom"> </td>
<td align="center" valign="middle"><a href="../excelexprt.php"></a></td>
<td align="center" valign="middle"> </td>
<td align="center" valign="middle"> </td>
<td align="right" valign="middle"><a href="excel.php"><img src="../images/Export.png" alt="Export" width="48" height="48" border="0" /></a></td>
</form> </tr>
<tr class="Header">
<td height="2" colspan="10" align="center" valign="bottom" id="filters3"><hr color="#333333" size="1px"/></td>
</tr>
<tr class="Header">
<td height="345" colspan="10" align="center" valign="bottom" id="filters"><a href="../excelexprt.php">
<iframe src="pai1.php" width="485px" height="370px" frameborder="0"></iframe>
</a></td>
</tr>
<tr class="Header">
<td height="22" colspan="3" align="center" valign="bottom" id="filters2"> </td>
<td align="left" valign="bottom"> </td>
<td align="left" valign="bottom"> </td>
<td align="left" valign="bottom"> </td>
<td colspan="4" align="center" valign="middle"> </td>
</tr>
<tr class="Header">
<td style="border: 1px solid #000;" height="44" colspan="3" align="center" valign="middle" bgcolor="#666666">Options</td>
<td style="border: 1px solid #000;" width="100" align="center" valign="middle" bgcolor="#666666" class="Header">Job ID</td>
<td style="border: 1px solid #000;" width="100" align="center" valign="middle" bgcolor="#666666">Market ID</td>
<td style="border: 1px solid #000;" width="100" align="center" valign="middle" bgcolor="#666666">Transaction No.</td>
<td style="border: 1px solid #000;" width="100" align="center" valign="middle" bgcolor="#666666">Entry Points</td>
<td style="border: 1px solid #000;" width="100" align="center" valign="middle" bgcolor="#666666">Department Points</td>
<td style="border: 1px solid #000;" width="100" align="center" valign="middle" bgcolor="#666666">General Points</td>
<td style="border: 1px solid #000;" width="100" align="center" valign="middle" bgcolor="#666666">Total Points</td>
</tr>
<?php do { ?> <tr>
<td width="31" height="28" align="center" style="border: 1px solid #000;"><a href="../pdf.php?Jobid=<?php echo $row_Recordset1['Jobid']; ?>" target="_blank"><img src="../images/pdf.png" alt="PDF Export" width="16" height="16" border="0" /></a></td>
<td width="31" style="border: 1px solid #000;" align="center"><a href="../view.php?Jobid=<?php echo $row_Recordset1['Jobid']; ?>" target="_blank"><img src="../images/preview.png" alt="Preview" width="16" height="16" border="0" /></a></td>
<td width="31" style="border: 1px solid #000;" align="center"><a href="../update_form.php?Jobid=<?php echo $row_Recordset1['Jobid']; ?>" target="_blank"><img src="../images/Edit.png" alt="Edit" width="16" height="16" border="0" /></a></td>
<td style="border: 1px solid #000;" align="right"><?php echo $row_Recordset1['Jobid']; ?> </td>
<td style="border: 1px solid #000;" align="right"><?php echo $row_Recordset1['Market']; ?> </td>
<td style="border: 1px solid #000;" align="right"><?php echo $row_Recordset1['General_10']; ?> </td>
<td style="border: 1px solid #000;" align="right"><?php echo $row_Recordset1['Entry_Points']; ?> </td>
<td style="border: 1px solid #000;" align="right"><?php echo $row_Recordset1['Dept_Points']; ?> </td>
<td style="border: 1px solid #000;" align="right"><?php echo $row_Recordset1['General_Points']; ?> </td>
<td style="border: 1px solid #000;" align="right"><?php echo $row_Recordset1['Total_Points']; ?> </td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
<table border="0" align="center" width="270px">
<tr>
<td width="30px" valign="middle"><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>"><img src="../images/first.png" alt="First" width="16" height="16" alt="First Page" /> </a>
<?php } // Show if not first page ?></td>
<td width="30px" valign="middle"><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>"><img src="../images/previous.png" alt="Previous Page" width="16" height="16" alt="previous" /> </a>
<?php } // Show if not first page ?></td>
<td width="150px" style="font-family:'Segoe UI'; font-size:12px; color:#333; font-weight:700; line-height:40px;"> Records <?php echo ($startRow_Recordset1 + 1) ?> to <?php echo min($startRow_Recordset1 + $maxRows_Recordset1, $totalRows_Recordset1) ?> of <?php echo $totalRows_Recordset1 ?></td>
<td width="30px" valign="middle"><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>"><img src="../images/Next.png" width="16" height="16" alt="Next" /> </a>
<?php } // Show if not last page ?></td>
<td width="30px" valign="middle"><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>"><img src="../images/Last.png" alt="Last Page" width="16" height="16" alt="Last" /> </a>
<?php } // Show if not last page ?></td>
</tr>
</table>
</table>
</div>
<div id="dash3_grid_bot"></div>
</div><br />
<br />
<br />
</td>
</tr>
</table>
<div id="dashboard">
</div>
</div>
<div class="dock" id="dock2">
<div class="dock-container2">
<a class="dock-item2" href="client.php"><span>Dashboard</span><img src="../Menu/images/Dashboard-.png" alt="home" /></a>
<a class="dock-item2" href="brakedown.php"><span>Brakedown Report</span><img src="../Menu/images/brakedown.png" alt="contact" /></a>
<a class="dock-item2" href="Compliance.php"><span>Compliance Report</span><img src="../Menu/images/compliance.png" alt="portfolio" /></a>
<a class="dock-item2" href="jobstatus.php"><span>Job Status Report</span><img src="../Menu/images/jobstatus.png" alt="music" /></a>
<a class="dock-item2" href="reports.php"><span>Reports</span><img src="../Menu/images/charts.png" alt="video" /></a>
<a class="dock-item2" href="#"><span>Logout</span><img src="../Menu/images/off.png" alt="history" /></a>
</div>
</div>
<!--Menu End-->
</div>
<!--Wrapper End-->
<!--dock menu JS options -->
<script type="text/javascript">
$(document).ready(
function()
{
$('#dock2').Fisheye(
{
maxWidth: 60,
items: 'a',
itemsText: 'span',
container: '.dock-container2',
itemWidth: 40,
proximity: 80,
alignment : 'left',
valign: 'bottom',
halign : 'center'
}
)
}
);
</script>
</body>
</html>
<?php
mysql_free_result($Recordset1);
mysql_free_result($status);
?>
Please Help me guys