Problema la un select option list cu date din mysql
Scris: Mar Sep 09, 2014
Buna seara de vreo 3 ore ma tot chinuiest la un select si nici cum nu imi iese
Nu reusesc, adica nu stiu cum sa fac la linia asta ca idFamiliei sa mi-l ia automat de la selectul de mai sus.
de aici !!
Vreau sa il pot lua automat de acolo in functie de ce famile aleg eu !
Va multumesc !
Cod: Selectaţi tot
echo "<table border='1'>";
echo "<form action='lista_noua.php' method='POST'>";
echo "<tr><td><b>Client</b></td><td><b>Familie</b></td><td><b>Alege Produs</b></td><td><b>Cantitate</b></td><td><b>Schimb</b></td><td><b>Formatia</b></td><td></td></tr>";
echo "<tr>";
echo "<td><select name='Client'>";
if($sql = $db->query("SELECT * FROM client"))
while($data = $sql->fetch_assoc()) {
$client = $data['Client'];
$IdClient=$data['IdClient'];
echo "<option name=".$client.">".$client."</option>";
}
echo "</select></td>";
echo "<td><select name='Familie'>";
if($sql = $db->query("SELECT * FROM famili"))
while($data = $sql->fetch_assoc()) {
$familie = $data['Familie'];
$Id=$data['IdFamilie'];
echo "<option name=".$familie.">".$familie."</option>";
}
echo "</select></td>";
echo "<td><select name='Produs'>";
if($sql = $db->query("SELECT * FROM produse WHERE IdFamilie = 2 ")) {
while($data = $sql->fetch_assoc()) {
$Denumire = $data['Denumire'];
echo "<option name=".$Denumire.">".$Denumire."</option>";
}
echo "</select></td>";
echo "<td><input type='text' name='Cantitate'/></td>";
echo "<td><select name='Schimb'>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
</select></td>";
echo "<td><select name='Formatia'>
<option value='A'>A</option>
<option value='B'>B</option>
<option value='C'>C</option>
</select></td>";
echo "<td><input type='submit' value='Adauga' name='submit'/></td>";
echo "</form>";
echo "</table>";
} else {
echo "A aparut o eroare";
}
Cod: Selectaţi tot
if($sql = $db->query("SELECT * FROM produse WHERE IdFamilie = 2 ")) {
Cod: Selectaţi tot
echo "<td><select name='Familie'>";
if($sql = $db->query("SELECT * FROM famili"))
while($data = $sql->fetch_assoc()) {
$familie = $data['Familie'];
$Id=$data['IdFamilie'];
echo "<option name=".$familie.">".$familie."</option>";
}
echo "</select></td>";
Vreau sa il pot lua automat de acolo in functie de ce famile aleg eu !
Va multumesc !