probleme champ formulaire non pris en compte
Bonjour voila j'ai script php qui me permet d'afficher une liste déroulante qui affiche un champ d'une d mes tables de ma bdd je clique sur valider et la il est censé sélectionnez une ligne de ma table celle de l id sélectionné mais il n prend pas bien le champ id il prend la dernière valeur du champ id d ma table voici le code
script 1 dvd.php :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
<?php
$rq = "SELECT iddvd FROM tlm_dvd";
$result = mysql_query($rq) or die ("Exécution de la requête impossible");
echo "<form action='dvd2.php' method='post'><select name='form_dvd'>";
while ($liste=mysql_fetch_array($result))
{
extract($liste);
if(isset($_POST['iddvd']) && $iddvd == $_POST['iddvd'])
echo " <option value='$iddvd' selected> $iddvd\n";
else
echo " <option value='$iddvd'>Dvd $iddvd\n";
}
echo "</select>\n";
echo "<input type='submit'"."value='choisir' name='choix_dvd'></form>\n";
?> |
script 2 dvd2.php :
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
|
$sql2 = "SELECT * FROM tlm_titre WHERE iddvd='$iddvd'" ;
$req2 = mysql_query($sql2) or die( mysql_error() ) ;
$total2 = mysql_num_rows($req2);
{
echo '<form method ="post" action="dvd2.php">';
echo '<table>'."\n";
echo '<tr>';
echo '<th ><b>Dvd</b></th>';
echo '<th ><b>titre</b></th>';
echo '<th><b>zone</b></th>';
echo '</tr>'."\n";
while($row = mysql_fetch_array($req2))
{
echo '<tr>';
echo '<td>'.$iddvd.'</td>';
echo '<td><textarea row="4" name="Dvd" value=votre texte />
</textarea></td>';
echo '<td><textarea row="4" name="titre" value=votre texte />
</textarea></td>';
echo '<td><textarea row="3" name="zone" value=votre texte />
</textarea></td>';
echo '</tr>'."\n";
echo '</table>'."\n";
echo '<input type="hidden" name="dvd2" value=$iddvd /><br><input type="submit" name="ok" value="Modifier"/>';
echo '</form>';
}
} |