bonjour a tous
voila mon problém j ai realiser une pagination pour ma page web qui affiche un tableau long
cette table s affiche apres un double filtre realiser avec des liste deroulante
le pagination fonnctionne corectement sauf que lorsque je clique sur "next" je suis obliger a realiser le meme filtre que la premiere fois pour que je puisse voire la deuxiémme page .....
voila le code de ma page
et le code de la page2.php
voila le code de ma table clients en sql
merci d avance
voila mon problém j ai realiser une pagination pour ma page web qui affiche un tableau long
cette table s affiche apres un double filtre realiser avec des liste deroulante
le pagination fonnctionne corectement sauf que lorsque je clique sur "next" je suis obliger a realiser le meme filtre que la premiere fois pour que je puisse voire la deuxiémme page .....
voila le code de ma page
<?php
session_start();
require_once('connexion.php'); ?>
<?php
if(isset($_POST['out']))
{
?>
<a href="index.html?errur=logout"/>
<?php
}
?>
<?php
// On relaye la session
//if (session_is_registered("authentification")){ // vérification sur la session authentification (la session est elle enregistrée ?)
// ici les éventuelles actions en cas de réussite de la connexion
//}
//else {
//header("Location:index.php?erreur=intru"); // redirection en cas d'echec
//}
//?>
<head>
<title>Report </title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link href="css/Copy of rp-stylesheet.css" rel="stylesheet" type="text/css" />
<link href="css/calander.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="container">
<div id="header">
<h1> <a href="http://www.primeclass.com.tr/en/Pages/Default.aspx"><img src="img/Logo (1).png"></a></h1>
<ul>
<li><a href="index.html" ><font size="5">Home</font> </a></li>
</ul>
</div>
<div id="body">
<div>
<div id="content">
<p align="right">
<a href="index.html">LogOut </a>
<br>
<a href="accueil.php">Your Space </a>
<br>
<h2>Report Booking </h2>
<form action="" method="post" name="add">
<table>
<tr>
<td>
<font size="4"><b>View report booking by :</b></font>
</td>
</tr>
<tr>
<td>
<?php echo' <select name="type">
<option value="">--Select--</option>
<option value="cipoperator">Cip Operator</option>
<option value="ServiceName">Service Name</option>
<option value="AirlineCompany">Airline Company </option>
<option value="destination">Destination </option>
</select>
<input type="submit" name="valider" value=" view Report"></td></tr>';
if(isset($_POST['valider']))
{
$value=$_POST['type'];
if($value=='cipoperator')
{
$select='SELECT DISTINCT cipoperator FROM clients order by cipoperator ';
$result = mysql_query($select) or die ('Erreur : '.mysql_error() );
$total = mysql_num_rows($result);
echo'<tr><td>choose your Cip Operator :</td><td><select name="cip"><option>---select---</option>';
?><?php if($total) {
while($row = mysql_fetch_array($result)) {
echo"<option>".$row['cipoperator']."</option>";
}
}
echo'</select>
<input type="submit" name="valider1" value="view"></td></tr>';
}
}
if(isset($_POST['valider1']))
{
$value=$_POST['cip'];
include ('page2.php');
echo'<table><tr></tr><tr><td><a href="treatsxl.php?variable='.$value.'"><img src="img\1.jpg"></td><td></td></tr>';
}
?>
</table><!--endprint-->
et le code de la page2.php
<?php
require_once('connexion.php');
?><?php $select= mysql_query("SELECT * FROM clients WHERE cipoperator='". $value."'");
$nr = mysql_num_rows($select) or die ('Erreur : '.mysql_error() );
if (isset($_GET['pn'])) {
$pn = preg_replace('#[^0-9]#i', '', $_GET['pn']);
} else {
$pn = 1;
}
$itemsPerPage = 10;
$lastPage = ceil($nr / $itemsPerPage);
if ($pn < 1) {
$pn = 1;
} else if ($pn > $lastPage) {
$pn = $lastPage;
}
$centerPages = "";
$sub1 = $pn - 1;
$sub2 = $pn - 2;
$add1 = $pn + 1;
$add2 = $pn + 2;
if ($pn == 1) {
$centerPages .= ' <span class="pagNumActive">' . $pn . '</span> ';
$centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $add1 . '">' . $add1 . '</a> ';
} else if ($pn == $lastPage) {
$centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $sub1 . '">' . $sub1 . '</a> ';
$centerPages .= ' <span class="pagNumActive">' . $pn . '</span> ';
} else if ($pn > 2 && $pn < ($lastPage - 1)) {
$centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $sub2 . '">' . $sub2 . '</a> ';
$centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $sub1 . '">' . $sub1 . '</a> ';
$centerPages .= ' <span class="pagNumActive">' . $pn . '</span> ';
$centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $add1 . '">' . $add1 . '</a> ';
$centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $add2 . '">' . $add2 . '</a> ';
} else if ($pn > 1 && $pn < $lastPage) {
$centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $sub1 . '">' . $sub1 . '</a> ';
$centerPages .= ' <span class="pagNumActive">' . $pn . '</span> ';
$centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $add1 . '">' . $add1 . '</a> ';
}
$limit = 'LIMIT ' .($pn - 1) * $itemsPerPage .',' .$itemsPerPage;
$select="SELECT * FROM clients WHERE cipoperator='". $value."'$limit";
$result1 = mysql_query($select);
$total = mysql_num_rows($result1);
$paginationDisplay = "";
if ($lastPage != "1"){
if ($pn != 1) {
$previous = $pn - 1;
$paginationDisplay .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $previous . '"> Back</a> ';
}
$paginationDisplay .= '<span class="paginationNumbers">' . $centerPages . '</span>';
if ($pn != $lastPage) {
$nextPage = $pn + 1;
$paginationDisplay .= ' <a href="' . $_SERVER['PHP_SELF'] . '?pn=' . $nextPage . '"> Next</a> ';
}
}
////////////
?><?php $outputList = '';
if($total) {
?> <br><!--startprint--><table border="2" align="center" ><tr><?php echo'<br><b>The report of the Cip Operator : <font color="red">'. $value.'</font></b><br><br>';?>
</tr><tr><td><font color="red">Cip Operator </font></td><td><font color="red">Date</font></td><td><font color="red">Name</font></td><td><font color="red"> Surname</font></td><td><font color="red"> Assisted_By</font></td><td><font color="red">Client Cost</font></td></tr>
<?php while($row = mysql_fetch_array($result1)) {
$outputList .= '<tr><td>'.$row['cipoperator'].'</td><td>'.$row["Name"].'</td><td>'.$row['Surname'].'</td><td>'.$row["Date"].'</td><td>'.$row["Assisted_By"].'</td><td>'.$row['clientcost'].'</td></tr>';
}
}
print "$outputList";
echo $paginationDisplay;
voila le code de ma table clients en sql
-- phpMyAdmin SQL Dump
-- version 3.5.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Mar 31, 2014 at 10:51 AM
-- Server version: 5.5.24-log
-- PHP Version: 5.3.13
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `tav`
--
-- --------------------------------------------------------
--
-- Table structure for table `clients`
--
CREATE TABLE IF NOT EXISTS `clients` (
`Passport_Num` int(11) NOT NULL,
`Name` varchar(20) NOT NULL,
`Surname` varchar(20) NOT NULL,
`N_OF_Guests` int(11) NOT NULL,
`N_OF_Children_Under_2_Years_Old` int(11) NOT NULL,
`Assisted_By` varchar(20) NOT NULL,
`Date` date NOT NULL,
`Time` time NOT NULL,
`cipoperator` varchar(20) NOT NULL,
`destination` varchar(20) NOT NULL,
`servicename` varchar(20) NOT NULL,
`airline` varchar(20) NOT NULL,
`flight` varchar(20) NOT NULL,
`clientcost` float NOT NULL,
`articleconsome` varchar(50) NOT NULL,
PRIMARY KEY (`N_OF_Children_Under_2_Years_Old`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `clients`
--
INSERT INTO `clients` (`Passport_Num`, `Name`, `Surname`, `N_OF_Guests`, `N_OF_Children_Under_2_Years_Old`, `Assisted_By`, `Date`, `Time`, `cipoperator`, `destination`, `servicename`, `airline`, `flight`, `clientcost`, `articleconsome`) VALUES
(4568952, 'selmi', 'sabrine', 0, 0, 'tavcip', '2014-03-30', '09:51:23', 'THOMAS COOK', 'GLASGOW', 'PRIME PACK', 'THOMAS COOK', 'TCX7072', 0.53, '+GreenTea'),
(465604899, 'Jamie', 'Chilton', 0, 1, 'Haifa, Maroua, Marie', '2014-03-28', '00:00:00', 'TUI', 'Stuttgart', 'PrimePack', 'Nouvelair', 'BJ202', 2.55, ''),
(520056992, 'Rebecca', 'Chilton', 0, 2, 'Haifa, Fares & Houss', '2014-03-28', '00:00:00', 'TUI', 'Stuttgart', 'PrimePack', 'Nouvelair', 'BJ202', 3.365, ''),
(501702878, 'Graham', 'Hill', 0, 3, 'Haifa, Fares & Houss', '2014-03-28', '00:00:00', 'Guest', 'Munich', 'PrimePack', 'Nouvelair', 'TU646', 3.36, ''),
(504168592, 'Frances', 'Hill', 0, 4, 'Haifa, Fares & Houss', '2014-03-28', '00:00:00', 'Guest', 'Munich', 'PrimePack', 'Nouvelair', 'HV154', 2.99, ''),
(651585465, 'Russell', 'Barton', 0, 5, 'Haifa, Fares & Houss', '2014-03-28', '00:00:00', 'Cash', 'Frankfurt', 'CIP', 'Tunisair', 'HV154', 4.28, ''),
(306079490, 'Janice', 'Young', 1, 6, 'Haifa, Fares & Houss', '2014-03-24', '00:00:00', 'Thomas Cook', 'Amsterdam', 'PrimePack', 'Transavia', 'TCX7073', 2.015, ''),
(111372837, 'Keith', 'Thompson', 0, 7, 'Haifa, Fares & Houss', '2014-03-15', '00:00:00', 'Thomas Cook', 'Amsterdam', 'PrimePack', 'Transavia', 'TCX7073', 5.065, ''),
(108167190, 'Jeanette', 'Moreland', 0, 8, 'Haifa, Fares & Houss', '2014-03-25', '00:00:00', 'Thomas Cook', 'Bristol', 'PrimePack', 'Thomas cook', 'TCX3217', 2.23, ''),
(209391386, 'Richard', 'Erna', 0, 9, 'Haifa, Fares & Houss', '2014-03-07', '00:00:00', 'Thomas Cook', 'Bristol', 'PrimePack', 'Thomas cook', 'TCX3217', 3.55, ''),
(209391628, 'Ann', 'Ramisch', 0, 10, 'Haifa, Fares & Houss', '2014-03-04', '00:00:00', 'Thomas Cook', 'Glasgow', 'PrimePack', 'Thomas cook', 'TCX7073', 2.58, ''),
(518031733, 'Melvyn', 'Ramisch', 0, 11, 'Haifa, Fares & Houss', '2014-03-23', '00:00:00', 'Thomas Cook', 'Glasgow', 'PrimePack', 'Thomas cook', 'TCX7073', 5.1, ''),
(461574175, 'Doreen', 'Ramisch', 0, 12, 'Haifa, Fares & Houss', '2014-03-16', '00:00:00', 'Thomas Cook', 'Bristol', 'PrimePack', 'Thomas cook', 'TCX1325', 2.58, ''),
(401705107, 'Susan', 'Schmitz', 0, 13, 'Haifa, Fares & Houss', '2014-03-28', '00:00:00', 'Thomas Cook', 'Bristol', 'PrimePack', 'Thomas cook', 'TCX1325', 2.06, ''),
(651774600, 'Rachelle', 'Josten', 0, 14, 'Haifa, Fares & Houss', '2014-03-15', '00:00:00', 'Thomas Cook', 'London', 'PrimePack', 'Thomas cook', 'TCX2017', 2.2, ''),
(460061739, 'Peter', 'Rehmann', 1, 15, 'Haifa, Fares & Houss', '2014-03-27', '00:00:00', 'Thomas Cook', 'London', 'PrimePack', 'Thomas cook', 'TCX2017', 2.9, ''),
(462097919, 'Patricia', 'Persigehl', 0, 16, 'Mariem, Marwa & Ouss', '2014-03-23', '00:00:00', 'Thomas Cook', 'Manchester', 'PrimePack', 'Thomas cook', 'TCX3217', 3.055, ''),
(0, 'Margarete', 'Persigehl', 0, 17, 'Mariem, Marwa & Ouss', '2014-03-17', '00:00:00', 'Thomas Cook', 'Manchester', 'PrimePack', 'Thomas cook', 'TCX3217', 2.105, ''),
(0, 'Christian', 'Delrue', 0, 18, 'Fawez & houssem', '2014-03-05', '00:00:00', 'Thomas Cook', 'Glasgow', 'PrimePack', 'Thomas cook', 'TCX2017', 2.295, ''),
(36887323, 'Anja', 'Delrue', 0, 19, 'Fawez & houssem', '2014-03-05', '00:00:00', 'Thomas Cook', 'Glasgow', 'PrimePack', 'Thomas cook', 'TCX2017', 2.215, ''),
(2147483647, 'Rudolf ', 'Henrich', 0, 20, 'Fawez & houssem', '2014-03-28', '00:00:00', 'Thomas Cook', 'Manchester', 'PrimePack', 'Thomas cook', 'TCX2017', 2.945, ''),
(0, 'Gerda ', 'Brech', 0, 21, 'Fawez & houssem', '2014-03-13', '00:00:00', 'Thomas Cook', 'Manchester', 'PrimePack', 'Thomas cook', 'TCX2017', 2.695, ''),
(0, 'Margarethe', 'Barnowski', 0, 22, 'Haifa & fares', '2014-04-22', '00:00:00', 'Thomas Cook', 'Manchester', 'PrimePack', 'Thomas cook', 'TCX2017', 3.895, ''),
(0, 'Gertrud', 'Balzer', 0, 23, 'Haifa & fares', '2014-03-16', '00:00:00', 'Thomas Cook', 'Manchester', 'PrimePack', 'Thomas cook', 'TCX2017', 2.515, ''),
(0, 'Richard', 'Maier', 0, 24, 'Marwa,Hayet,Haifa,Fa', '2014-03-12', '00:00:00', 'Thomas Cook', 'Manchester', 'PrimePack', 'Thomas cook', 'TCX4027', 4.895, ''),
(0, 'Gerlinde', 'Maier', 0, 25, 'Marwa,Hayet,Haifa,Fa', '2014-03-15', '00:00:00', 'Thomas Cook', 'Manchester', 'PrimePack', 'Thomas cook', 'TCX4027', 3.765, ''),
(591, 'Christofe', 'Maier', 1, 26, 'Marwa,Hayet,Haifa,Fa', '2014-03-25', '00:00:00', 'Thomas Cook', 'Birmingham', 'CIP', 'Thomas cook', 'TCX7073', 2.915, ''),
(591, 'Florence', 'Teufel', 0, 28, 'Marwa,Hayet,Haifa,Fa', '2014-03-18', '00:00:00', 'Thomas Cook', 'Birmingham', 'CIP', 'Thomas cook', 'TCX7073', 4.995, ''),
(217541697, 'Frank', 'Rogowski', 0, 29, 'Marwa,Hayet,Haifa,Fa', '2014-03-11', '00:00:00', 'Thomas Cook', 'Bristol', 'PrimePack', 'Thomas cook', 'TCX4027', 2.19, ''),
(0, 'Diana', 'Wasser ', 0, 30, 'Marwa,Hayet,Haifa,Fa', '2014-03-28', '00:00:00', 'Thomas Cook', 'Bristol', 'PrimePack', 'Thomas cook', 'TCX4027', 4.08, ''),
(518123562, 'Wener', 'Gibson', 0, 31, 'Hayet,Marwa,Haifa,Fa', '2014-03-28', '00:00:00', 'Pr. Pass', 'Birmingham', 'CIP', 'Thomas cook', 'TCX8015', 2.265, '');
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
merci d avance