Salut a tous,
Voila je debute en php et je me suis amuse a faire un p'tit site tout simple avec une base mysql...sous easyphp 1.4
Je suis passe sous easyphp 1.7 pour faire co les grands .....:-)
La quand j'ouvre ma page de recherche il me dit ceci:
Notice: Undefined index: motclef in c:\program files\easyphp1-7\www\test\rech\recherche.php3 on line 78
Notice: Undefined variable: clause in c:\program files\easyphp1-7\www\test\rech\recherche.php3 on line 91
Notice: Undefined variable: orderby in c:\program files\easyphp1-7\www\test\rech\recherche.php3 on line 91
Et bien sur qd je clique sur un lien de cette page qui devrait normalement me changer l'odre d'affichage....(orderby) il ne me fait rien!!!
Je comprends ce que cela veut dire....mais bon je ne vois pas trop ce que je dois faire....!? Dois je mettre quelque chose a on ou off ds php.ini !?
Quelqu'un a t il une idée....merci!
Voici le code de la page
<html>
<head>
<title>-- Recherche --</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<div align="right"><font face="Verdana, Arial, Helvetica, sans-serif" size="1">
<?php $da=date("j M Y");
echo "$da";?></font></div>
<br><table border=0 cellpadding=0 cellspacing=0 width=100%><tr><td height=22 width=17><img src="images/colg.gif"></td><td bgcolor="#FFCC66"><div class="title"><strong>M</strong>ecanique
<strong>M</strong>otor: Le garage proche de vous</div></td><td height=22 width=17><img src="images/cold.gif"></td></tr></table>
<BR>
<table width="100%" height="5%" border="0" cellspacing="0" cellpadding="0">
<tr>
<!-- Menu principal -->
<td width="100%" valign="top" class="navigation" colspan="2">
<center>
<a class="navigation" href="index.php3">Accueil</a> | <a class="navigation" href="recherche.php3">Voitures
d'occasions</a> | <a class="navigation" href="service.php3">Nos
services</a> | <a class="navigation" href="mailto:mecanique.motor@tiscali.be?subject=Contact">Nous
contacter</a> | <a class="navigation" href="plan.php3">Plan
d'acces</a> | <a class="navigation" href="admin.php3">Admin</a>
</center>
</td>
</tr>
</table>
<br>
<?
//MISE EN FORME
include("include/forme.php");
//connection
include("include/connection.php3");
?>
<p align="center"> <font size="1" face="Verdana, Arial, Helvetica, sans-serif">-
Faites votre recherche -</font></p>
<div align="center">
<form action="recherche.php3" method="post">
<div align="center">
<input type="text" name="motclef" value="<?php echo $motclef; ?>">
<input type="submit" value="Rechercher">
</div>
</form>
<form action="recherche.php3" method="post">
<div align="center">
<select name="ordre">
<option value="carbu">Trier par carburation</option>
<option value="date">Trier par date</option>
<option value="kilo">Trier par Km</option>
<option value="marque">Trier par marque</option>
<option value="modele">Trier par modele</option>
<option value="price">Trier par prix</option>
</select>
<input type="submit" value="Trier">
</div>
</form>
<br><div align="center"><table width="80%" align="center" style="border: 1 solid #CBCBCB">
</div>
</div>
<tr bgcolor="CCCCCC">
<td class="intitule" width="12%"><B><font size="1">Posté le :</font></B></td>
<td class="intitule" width="22%"><B><font size="1">Marque du véhicule :</font></B></td>
<td class="intitule" width="12%"><B><font size="1">Modele :</font></B></td>
<td class="intitule"><B><font size="1">Carburant :</font></B></td>
<td class="intitule"><B><font size="1">Kilométrage :</font></B></td>
<td class="intitule"><B><font size="1">Prix en Euros :</font></B></td>
<td class="intitule"><B><font size="1">Photo :</font></B></td>
</tr>
<?php
//CONNCECTION
//$mot = $_REQUEST['motclef'];
if (isset($motclef))
{
$clause = " WHERE marque LIKE '%$motclef%' OR des LIKE '%$motclef%' OR modele LIKE '%$motclef%'";
}
if (isset($ordre))
{
$orderby = " ORDER BY $ordre";
}
$sql = "SELECT * FROM annonce" . $clause . $orderby;
$resultat = mysql_query ($sql);
$nblignes = mysql_num_rows($resultat);
//affichage de nb
echo "<div align=center><font face=Verdana, Arial, Helvetica, sans-serif size=1>-Il y'a actuellement <B><$nblignes></b> voitures disponible-</font></div>";
echo"<br>";
//BOUCLE
$i = 0;
while ($eleve = mysql_fetch_array ($resultat))
{
//COULEUR
$couleur = "#CCCCCC";
$i++;
if ($i % 2 ==1)
{
$couleur = "#FFFFFF";
}
$id = $eleve['id'];
$ma = $eleve['marque'];
$mo=$eleve['modele'];
$ty=$eleve['type'];
$car = $eleve['carbu'];
$cy = $eleve['cylindre'];
$date = $eleve['date'];
$im = $eleve['photo'];
$de = $eleve['des'];
$ki = $eleve['kilo'];
$pr = $eleve['price'];
echo "<tr BGCOLOR=$couleur>";
echo "<td><font size=1>$date</font></td>";
echo "<td><a href=affiche.php3?id=$id target=_blank>$ma</a></td>";
echo "<td><font size=1>$mo</font></td>";
echo "<td><font size=1>$car</font></td>";
echo "<td><font size=1>$ki Km</font></td>";
echo "<td><font size=1>$pr Euros</font></td>";
echo "<td><a href=affiche.php3?id=$id target=_blank ><img src=upload/$im width=100 height=35 border=0 alt=$ma></a></td>";
echo "</tr>";
}
echo "</table>";
echo"<br>";
include('include/bas.php3');
mysql_close()
?>
</body>
</html>
Un grand merci
a bientot
Jimmy