Là j'ai besoin d'une petite aide pour que je puisse terminer mon programme je crois que mon probleme et juste la syntaxe et j'ai pas trop organisé mes trucs, sinon là je suis bloqué j'arrive pas reflichir j'ai un exame lundi prochain :p
sinon là est le programme :
Le programme consiste à faire une recherche sur un table (formation2) avec des champs (nom, prenom, matricule ...)
tout le programme est basé sur la recherche mais pas n'importe quel recherche.
Recherche 1 : Matricule
Recherche 2 : Nom
Là je veux qu'on choissise dans le saisie 1 des recherches
avec en bas des tries commun entre la date du debut et la date du fin avec un trie par (date, matricule, nom ASC)
mon probleme que j'arrive pas à devlopper une solution à ce que chaque recherche soit independante de l'autre.
Programme
--------------------------------------------------------------------------------------------------------------------------------------------
Index.php :---------------------
---------------------
<html>
<body>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<STYLE type=text/css>A:visited {
COLOR: #0000cc; TEXT-DECORATION: none
}
A:link {
COLOR: #0000cc; TEXT-DECORATION: none
}
A:hover {
COLOR: #339933; TEXT-DECORATION: none
}
</STYLE>
</HEAD>
<BR>
<!--<table border=0 width="95%" align="center">
<tr>
<td>
<p align="justify">
<font size="2" face="Tahoma"> Pour obtenir l'historique individuel des différentes formations suivies par chaque
agent, saisissez son matricule ou à défaut son nom (ou abréviation), puis choisissez la période souhaitée et le classement des formations
(par domaine, thème ou date), puis cliquez sur le bouton Valider.
</font>
</p>
<p align="justify">
<font size="2" face="Tahoma">Remarque: il n'est pas tenu compte au niveau du nom du type des caractères (majuscule ou minuscule).
</font></p>
</td>
</tr>
</table>-->
<table border=0 width="95%" align="center">
<tr>
<td>
<p align="justify">
<font size="2" face="Tahoma"> Cette rubrique vous permet de consulter la liste des agents ayant bénéficié d'une ou de plusieurs formations.</font>
</p>
<p align="justify">
<font size="2" face="Tahoma"> Vous pouvez afficher ces données par entité, par domaine, par théme ou en combinant les trois possibilités. Faites votre sélection, votre critére de tri et validez.</font>
</p>
</td>
</tr>
</table>
<br>
<form method="post" action="index1.php">
<TABLE align=center border=0 cellPadding=1 cellSpacing=0>
<TR>
<TD><font size="2" face="Tahoma"> Matricule </font></td>
<td><INPUT name=recherche1 style="HEIGHT: 22px; WIDTH: 81px">
</TD>
</TR>
<form method="post" action="index2.php">
<TR>
<TD><font size="2" face="Tahoma"> Nom </font></td>
<td><INPUT name=recherche2 style="HEIGHT: 22px; WIDTH: 226px">
</TD>
</TR>
</table>
<br>
<TABLE align=center border=1 bordercolor=darkgreen width=60% cellPadding=1 cellSpacing=0>
<tr>
<td>
<TABLE align=center width=100% border=0 cellPadding=1 cellSpacing=0>
<TR>
<td>
<select name="recherche3">
<option value="1997">Choisir l'année debut de formation -->
<option value="1997">1997
<option value="1998">1998
<option value="1999">1999
<option value="2000">2000
<option value="2001">2001
<option value="2002">2002
<option value="2003">2003
<option value="2004">2004
<option value="2005">2005
</select>
<td>
<select name="recherche4">
<option value="2005">Choisir l'année fin de formation -->
<option value="2005">2005
<option value="2004">2004
<option value="2003">2003
<option value="2002">2002
<option value="2001">2001
<option value="2000">2000
<option value="1999">1999
<option value="1998">1998
<option value="1997">1997
</select>
</td>
<td>
<SELECT name=order id=order>
<option value="2005">Trier par -->
<option value="au">Date
<option value="matricule">Matricule
<option value="theme">Théme
</SELECT></td><td><br>
<input type="submit" name="B2" value="Envoyer">
</form>
</td>
</tr>
</table>
<br>
</td>
</tr>
</table>
Index1.php :-------------
-------------
<?php
include("index.php");
$c = @mysql_connect('localhost','root','') or die('connection impossible');
@mysql_select_db('lydec',$c) or die('selection impossible');
$sql = "SELECT * FROM formation2 where matricule like '$recherche1' and year(du) >= '$recherche3' and year(au) <= '$recherche4' order by '$order' asc";
($p = @mysql_query($sql,$c))?><br><br>
<font size="2" face="tahoma" color="#000000"><b>Les resultats pour le matricule <? print "$recherche1"; ?> entre la periode du <? print "$recherche3"; ?> au <? print "$recherche4"; ?> trie par <? print "$order"; ?> sont :</b></font></td>
<table border="1" borderColor="#ffffff" cellPadding="1" cellSpacing="0" width="95%" align="center">
<br>
<tr bgcolor="#000000">
<td align="center"><font size="2" face="tahoma" color="#ffffff"><b>Theme</b></font></td>
<td align="center"><font size="2" face="tahoma" color="#ffffff"><b>NOM</b></font></td>
<td align="center"><font size="2" face="tahoma" color="#ffffff"><b>Prénom</b></font></td>
<td align="center"><font size="2" face="tahoma" color="#ffffff"><b>Du</b></font></td>
<td align="center"><font size="2" face="tahoma" color="#ffffff"><b>Au</b></font></td>
<?
while($r = @mysql_fetch_array($p))
{
?>
<tr bgcolor="#000000">
<td align="center"><font size="2" face="tahoma" color="#ffffff"><b><? print "$r[theme]"; ?></b></font></td>
<td align="center"><font size="2" face="tahoma" color="#ffffff"><b><? print "$r[nom]"; ?></b></font></td>
<td align="center"><font size="2" face="tahoma" color="#ffffff"><b><? print "$r[prenom]"; ?></b></font></td>
<td align="center"><font size="2" face="tahoma" color="#ffffff"><b><? print "$r[du]"; ?></b></font></td>
<td align="center"><font size="2" face="tahoma" color="#ffffff"><b><? print "$r[au]"; ?></b></font></td>
<?
}
?>
</tr>
</table>
</body>
</html>
Index2.php : -----------
-----------
<?php
include("index.php");
$c = @mysql_connect('localhost','root','') or die('connection impossible');
@mysql_select_db('lydec',$c) or die('selection impossible');
$sql = "SELECT * FROM formation2 where nom like '$recherche2' and year(du) >= '$recherche3' and year(au) <= '$recherche4' order by '$order' asc";
($p = @mysql_query($sql,$c))?><br><br>
<font size="2" face="tahoma" color="#000000"><b>Les resultats pour le nom <? print "$recherche2"; ?> entre la periode du <? print "$recherche3"; ?> au <? print "$recherche4"; ?> trie par <? print "$order"; ?> sont :</b></font></td>
<table border="1" borderColor="#ffffff" cellPadding="1" cellSpacing="0" width="95%" align="center">
<br>
<tr bgcolor="#000000">
<td align="center"><font size="2" face="tahoma" color="#ffffff"><b>Theme</b></font></td>
<td align="center"><font size="2" face="tahoma" color="#ffffff"><b>Matricule</b></font></td>
<td align="center"><font size="2" face="tahoma" color="#ffffff"><b>NOM</b></font></td>
<td align="center"><font size="2" face="tahoma" color="#ffffff"><b>Prénom</b></font></td>
<td align="center"><font size="2" face="tahoma" color="#ffffff"><b>Du</b></font></td>
<td align="center"><font size="2" face="tahoma" color="#ffffff"><b>Au</b></font></td>
<?
while($r = @mysql_fetch_array($p))
{
?>
<tr bgcolor="#000000">
<td align="center"><font size="2" face="tahoma" color="#ffffff"><b><? print "$r[theme]"; ?></b></font></td>
<td align="center"><font size="2" face="tahoma" color="#ffffff"><b><? print "$r[matricule]"; ?></b></font></td>
<td align="center"><font size="2" face="tahoma" color="#ffffff"><b><? print "$r[nom]"; ?></b></font></td>
<td align="center"><font size="2" face="tahoma" color="#ffffff"><b><? print "$r[prenom]"; ?></b></font></td>
<td align="center"><font size="2" face="tahoma" color="#ffffff"><b><? print "$r[du]"; ?></b></font></td>
<td align="center"><font size="2" face="tahoma" color="#ffffff"><b><? print "$r[au]"; ?></b></font></td>
<?
}
?>
</tr>
</table>
</body>
</html>
--------------------------------------------------------------------------------------------------------------------------------------------
J'ai essayé là dans la source de separer les recherches, si vous m'aidez je vous saurais tres reconnaissant.
Je suis connecté 24/24h sur msn pour une aide online :) merci
MSN --> admin@webmasterx.be
. :: WebmasterX :: .