categorie et sous categorie!
en faite j ai un probleme d'affichage de categorie et sous categorie exemple quand je choisie une categorie (voiture) normalement dans sous categorie vient les marque des voiture ches mois rien ne se passe .est ce que quelqu'un a une solution? merci d'avance
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 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
| <?php
include("../include/var.php");
$db = mysql_connect($sql_host, $sql_user, $sql_password) or die("Faute,quelque chose a mal tourné. Il n'ya pas eu de contacts avec la base de données.");
mysql_select_db($sql_db) or die("Faute,quelque chose a mal tourné. La base de données sélectionné n'existe pas.");
?>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
<!--
function openURL() {
var control = document.form.Categorie;
if (control.options[control.selectedIndex].value != 'pas-url') {
location.href = control.options[control.selectedIndex].value;
}
}
//-->
</SCRIPT>
</head>
<body>
<td width="92%" valign="top" style="padding-left:20px;padding-right:15px;padding-bottom:15px">
<font class="kop">Déposez une annonce</font>
<DIV><strong>1. Votre produits</strong> | 2. Créer une annonce | 3. Confirmation de votre produits</DIV>
<table width="100%" border="0">
<tr>
<td height="1" bgcolor="#808080"></td>
</tr>
</table>
<br>
<table width="85%" border="0">
<tr>
<font class="navigatie"><a href="../home.php">Accueil</a> > Déposez une annonce</a></font>
<script language="javascript">
function CheckForm()
{
if (document.form.Categorie.value == "")
{
alert("Attention: Le formulaire n'est pas rempli.\nChoisissez une catégorie et appuyez sur Suivant.");
document.form.Categorie.focus();
}
else if (document.form.Souscategorie.value == "")
{
alert("Attention: Le formulaire n'est pas rempli.\nChoisissez une catégorie et appuyez sur Suivant.");
document.form.Souscategorie.focus();
}
else
document.form.submit();
}
</script>
<form name="form" action="deposez_une_annonce_suite.php" method="post">
<input type="hidden" name="Action" value="Continuer">
<table width="400" border="0" cellpassing="0" cellspacing="0">
<tr>
<td colspan="2">Choisissez une catégorie et sous-catégorie et cliquez sur"Suivant".<br><br><br></td>
<td width="100"><br></td>
</tr>
<tr>
<td width="230" valign="top"><b>Catégories: </b></td>
<td width="200">
<?
$sql = "SELECT * FROM categorie ORDER BY categorie_id ASC";
$result = mysql_query($sql);
if (mysql_numrows($result) != 0)
{
echo "<select name=\"Categorie\" style=\"width: 300;\" onchange=\"openURL()\">\n";
echo " <option value=\"pas-url\""; If (!$Categorie) echo " selected"; echo " >Choisissez une catégorie:</option>\n";
echo " <option value=\"pas-url\">----------------------------------------------------------------</option>\n";
While ($row = mysql_fetch_object($result))
{
echo " <option value=\"deposez_une_annonce.php?Categorie=$row->categorie_id\""; If ($row->categorie_id == $Categorie) echo " selected"; echo ">$row->description</option>\n";
}
echo "</select><br><br>\n";
}
?>
</td>
<td width="100"><br></td>
</tr>
<tr>
<td width="230" valign="top"><b>Sous catégories: </b></td>
<td width="200">
<?php
$sql = "SELECT * FROM souscategorie WHERE categorie_id = '$Categorie' ORDER BY description ASC";
$result = @mysql_query($sql);
echo "<select name=\"Souscategorie\" style=\"width: 300;\">\n";
echo " <option value=\"\""; If (!$Souscategorie) echo " selected"; echo " >Choisissez une sous catégorie:</option>\n";
echo " <option value=\"\">----------------------------------------------------------------</option>\n";
While ($row = mysql_fetch_object($result))
{
echo " <option value=\"$row->souscategorie_id\""; If ($row->souscategorie_id == $Souscategorie) echo " selected"; echo ">$row->description</option>\n";
}
echo "</select><br><br>\n";
?> |