Bonjour
Je suis obligé de passer ce message en textbox
Je n'arrive pas à utiliser les conditions if et else avec une option sélect
J'explique j'ai quatre options sélect les deux premières fonctionnent les deux suivantes me ranènent pas les infos que je veut récuperer.
Voici mon prog source la partie en vert fonctionne celle qui en violet ne fonctionne pas.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<?
require('fonctionsLdap.php');
?>
<html>
<head>
<title>recherche</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function rechargerPage()
{
document.location.href = './rechercher.php?typeRecherche=' + document.all['typeRecherche'].options[document.all['typeRecherche'].options.selectedIndex].value;
}
function validerForm()
{
document.all['formRecherche'].submit();
}
</script>
</head>
<body>
<?
echo "<form name=formRecherche method=\"get\" action=\"rechercher.php\">";
echo "Rechercher <select name=\"typeRecherche\" onChange=\"rechargerPage();\">";
if (!isset($_GET['typeRecherche']) || $_GET['typeRecherche'] == 0)
{
echo "<option selected value=0>une personne à partir de son nom et/ou prénom</option>\n";
echo "<option value=1>le personnel d'un service</option>\n";
echo "<option value=2>le numéro de téléphone</option>\n";
echo "<option value=3>par son email</option>\n";
echo "</select><br><br>";
echo "Nom et/ou prénom à rechercher : ";
echo "<input type=text name=nomRecherche>";
echo "<p><input type=submit value=\"Rechercher\"><input type=reset value=\"Annuler\"></p>";
}
else
{
echo "<option value=0>une personne à partir de son nom et/ou prénom</option>\n";
echo "<option selected value=1>le personnel d'un service</option>\n";
echo "<option value=2>le numéro de téléphone</option>\n";
echo "<option value=3>l'adresse de messagerie</option>\n";
echo "</select><br><br>";
echo "Nom du service à rechercher : ";
echo "Numéro de téléphone à:rechercher ";
echo "Adresse de messagerie à: rechercher ";
echo "<select id=serviceRecherche name=serviceRecherche onChange=\"validerForm();\">";
echo "<select id=usersRecherche name=usersRecherche onChange=\"validerForm();\">";
echo "<select id=usersRecherche name=usersRecherche onChange=\"validerForm();\">";
$services = getEntry("Services", "numService", "*", "");
echo "<option></option>";
for ($i = 0; $i < $services["count"]; $i++)
$users = getEntry("users" , " telephonenumber" , "*" , "");
echo "<option></option>";
for ($i = 0; $i < $users["count"]; $i++)
$users = getEntry("users" , " mail" , "*" , "");
echo "<option></option>";
for ($i = 0; $i < $users["count"]; $i++)
{
If ($services[$i]["numservice"][0] != "")
If ($users[$i]["telephonenumber"][0] != "")
IF ($users[$i]["mail"][0] != "")
{
If ($serviceRecherche == $services[$i]["numservice"][0] || $_GET['serviceRecherche'] == $services[$i]["numservice"][0])
If ($usersRecherche == $users[$i]["telephonenumber"][0] || $_GET['Userstelephonenumber'] == $users[$i]["telephonenumber"][0])
If ($usersRecherche == $users[$i]["mail"][0] || $_GET['usersmail'] == $users[$i]["mail"][0])
echo "<option selected value=" . $services[$i]["numservice"][0] . ">" . $services[$i]["nomservice"][0] . "</option>";
echo "<option selected value=" . $users[$i]["telephonenumber"][0] . ">" . $users[$i]["telephonemumber"][0] . "</option>";
echo "<option selected value=" . $users[$i]["mail"][0] . ">" . $users[$i]["mail"][0] . "</option>";
else
echo "<option value=" .$services[$i]["numservice"][0] . ">" . $services[$i]["nomservice"][0] . "</option>";
echo "<option value=" .$users[$i]["telephonenumber"][0] . ">" . $users[$i]["telephonemumber"][0] . "</option>";
echo "<option value=" .$users[$i]["mail"][0] . ">" . $users[$i]["mail"][0] . "</option>";
}
}
echo "</select>";
}
echo "</form>";
if (isset($_GET['nomRecherche']) || isset($_GET['serviceRecherche']))
if (isset($_GET['nomRecherche']) || isset($_GET['usersRecherche']))
if (isset($_GET['nomRecherche']) || isset($_GET['usersRecherche']))
{
If (isset($_GET['nomRecherche']))
$res = getEntry("Users", "cn", "*" . $_GET['nomRecherche'] . "*", "sn");
Else
$res = getUsersService($_GET['serviceRecherche']);
$res = getUserstelephone ($_GET['usersRecherche']);
$res = getUsersmail ($_GET['usersRecherche']);
$color = 0;
echo $res ["count"];
For ($i = 0; $i < $res["count"]; $i ++)
{
echo "<table cellspacing=3 border=0 width=90%>
<tr align=center bgcolor=\"#0071B1\"><font color=\"white\">
<th width=25%><font color=\"white\">Nom</font></th>
<th width=15%><font color=\"white\">Prénom</font></th>
<th width=4%><font color=\"white\">Téléphone</font></th>
<th width=15%><font color=\"white\">UF</font></th>
<th width=40%><font color=\"white\">Mail</font></th>
</tr>";
$j = 0;
$k = $i;
While ($j < 5 && $k < $res["count"])
{
If ($res[$k]["uid"][0] != "Invite")
{
If ($color == 0)
{
echo "<tr bgcolor=\"#D9EAF3\">";
$color = 1;
}
else
{
echo "<tr bgcolor=\"#F2F8FB\">";
$color = 0;
}
$uf = getEntry("UFs", "numUF", $res[$k]["numuf"][0], "");
echo "<td> " . strtoupper($res[$k]["sn"][0]);
IF (strcmp($res[$k]["nommarital"][0], "") != 0)
echo " (" . strtoupper($res[$k]["nommarital"][0]) . ")";
echo "</td><td> " . $res[$k]["givenname"][0] . " </td><td> " . $res[$k]["telephonenumber"][0] . " </td><td>" . $uf[0][nomuf][0] . "</td><td><a href=\"mailto:" . $res[$k]["mail"][0] . "\">" . $res[$k]["mail"][0] . "</a></td></tr>\n";
$j++; $k++;
}
else
{
$k++; $i++;
}
}
echo "</table><br><br>";
}
If ($res["count"] == 0)
echo "Aucun résultat pour cette recherche";
}
?>
</body>
</html>
En fait si le prog n'est pas imprimé on ne voit pas les couleurs
Alors la recherche du nom et du service fonctionnent c'est la recherche du N° de téléphone et l'émail qui ne fonctionne pas.
Si quelqu'un à une soluce a mon problême merci d'avance .
A+
Gigawatt