Bonsoir,

je souhaite ajouter un formulaire de recherche dans ma page (display), mais je ne sais pas trop comment faire ! car il faut gérer les paginations en même temps, un petit coup de main serait le bienvenue, merci....

voici le code.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
switch ($_GET['c']){
 
case 'display':
//formulaire de recherche ICI
?>
 
<form method="post" action="<?php echo $_SERVER["PHP_SELF"]; ?>?r=<?php echo $r; ?>&amp;ru=<?php echo $ru; ?>&amp;c=display">
	<input type="text" name="alpha" size="20" value="<?php if (!empty($_POST["alpha"])) {echo htmlspecialchars($_POST["alpha"],ENT_QUOTES); } ?>" />
	<input type="image" name="envoyer" src="images/valider.gif" alt="valider" />
	</form>
<?php
	$parpage = 30;
	if ( !isset($_GET['p']) ) {
	$debut= 0;
	$p = 1;
	$r=$_GET['r'];
	$c=$_GET['c'];
	$alpha=$_GET['alpha'];
	}
	else {
	$debut = ($_GET['p'] * $parpage) - $parpage;
	$p=$_GET['p'];
	$r=$_GET['r'];
	$c=$_GET['c'];
	$alpha=$_GET['alpha'];
	}
	$requeteSQLP="SELECT * FROM links WHERE titre LIKE '$alpha' ORDER BY titre ASC LIMIT $debut,$parpage";
	$resultSQLP=mysql_query($requeteSQLP);
	$nb_resultats = mysql_num_rows($resultSQLP);
	$requeteSQL="SELECT * FROM links WHERE titre LIKE '$alpha' ORDER BY titre ASC";
	$resultSQL=mysql_query($requeteSQL);
	$total_resultats = mysql_num_rows($resultSQL);
	require("include/pagination.php");
	?>
	<form action="<?php echo $_SERVER["PHP_SELF"]; ?>?r=<?php echo $r; ?>&amp;ru=<?php echo $ru; ?>&amp;c=deletechecktmp" method="post">
	<table summary="">
	<tr>
	<th>update/delete</th>
	<th>ID</th>
	<th>titre</th>
	<th>url</th>
	<th>description</th>
	</tr>
	<?php
	$i = 0;
	while ($resultat = mysql_fetch_array($resultSQLP))
	{ ?>	
	<tr class="ligne<?php echo ($i % 2); ?>">
	<td><input type="checkbox" name="id[]" value="<?php echo $resultat['id_links']; ?>" />
	<a href="<?php echo $_SERVER["PHP_SELF"]; ?>?r=<?php echo $r; ?>&amp;ru=<?php echo $ru; ?>&amp;c=update&amp;id=<?php echo $resultat['id_links']; ?>" title="modifié">updtae</a>
	<a href="<?php echo $_SERVER["PHP_SELF"]; ?>?r=<?php echo $r; ?>&amp;ru=<?php echo $ru; ?>&amp;c=deletetmp&amp;id=<?php echo $resultat['id_links']; ?>" title="supprimé">delete</a>
	</td>
	<td><?php echo $resultat['id_links']; ?></td>
	<td><?php echo stripslashes($resultat['links']); ?></td>
	<td><?php echo stripslashes($resultat['url']); ?></td>
	<td><?php echo stripslashes($resultat['description']); ?></td>
	</tr>
	<?php
	$i++;
	}
	?>
	</table>
	<input type="image" name="delete" src="media/icons/cross.png" value="delete" />supprimer les cases cochés
	</form>
	<?php require("include/pagination.php");
break;