Passage d'arguments avec la méthode GET
Bonjour,
je ne comprends pas je sais que je souhaite afficher mes labels selon la premeire lettre du label j ai un buton.php ave cun menu qui pointe vers un fichier label.php qui utilise la fonction GET celui ci doit recuperer dans l url le mot "lettre" afin d afficher les bonnes entrées selon le menu selectionner je sais que je dois mettre "label.php?lettre=a" "label.php?lettre=b" ... dans mes liens dans mon m,eu mais la focntion include me gene je ne peux pas le faire.... j espere que vous comprenez car je ne sais aps si je suis claire
voic le bouton.php
Code:
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 68 69
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN"
"http://www.w3.org/TR/xhtmll/DTD/xhtmll-transitional.dtd">
<html Xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>listing</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<ul class="menu">
<li><a href="bouton.php?page=label" target="_self" class="active"><span>Label 0-
9</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label A</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label B</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label C</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label D</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label E</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label F</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label G</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label H</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label I</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label J</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label K</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label L</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label M</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label N</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label O</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label P</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label Q</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label R</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label S</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label T</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label U</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label V</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label W</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label X</span></a></li>
<li><a href="bouton.php?page=label" target="_self"><span>Label Y</span></a></li>
<li><<a href="bouton.php?page=label" target="_self"><span>Label Z</span></a></li>
<?php
if(!empty($_GET['page']))
{
if(file_exists($_GET['page'].'.php') AND !preg_match("/
(\.|config|inc)/iU", $_GET['page']))
{
include ($_GET['page'].'.php');
}
}
?>
</ul>
</body>
</html> |
et voici le label.php
Code:
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81
| <!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" dir="ltr">
<head>
<meta http-equiv="content-type"
content="text/html; charset=iso-8859-1" />
<title></title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<br></br>
<br></br>
<br></br>
<br></br>
<br></br>
<?php
include ('config.php');
include ('connexion.php');
echo '<table>
<tr>
<th>Label</th>
<th>Référence</th>
<th>Artiste</th>
<th>Album</th>
<th>Format</th>
<th>Modifier</th>
<th>Supprimer</th>
</tr>';
// paramètre reçu désignant le critère du nom du label recherché
$param1 = ($_GET['lettre']);
//
$sql = "SELECT * FROM label
INNER JOIN contenu ON contenu.id_label = label.id_label
Where nom_label LIKE '$param1%' order by nom_label, reference;
";
$req = mysql_query($sql);
while ($resultat = mysql_fetch_array($req))
{
echo '<tr>';
echo '<td>'.$resultat['nom_label'].'</td>';
echo '<td>'.$resultat['reference'].'</td>';
echo '<td>'.$resultat['artiste'].'</td>';
echo '<td>'.$resultat['album'].'</td>';
echo '<td>'.$resultat['format'].'</td>';
echo '<td><a href="formulaire_de_mise_a_jour.php?reference='.$resultat
['reference'].'">Modifier</a></td>';
echo '<td><a href="script_de_suppression.php?reference='.$resultat
['reference'].'">Supprimer</a></td>';
echo '</tr>';
}
echo '</table>';
?>
</body></html>
<?php
mysql_close();
?> |