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
| if (isset($_POST['valider'])){
if (($check == $dvd_s) && ($check==$dvd_c)){
echo "La version standard et collector du dvd existe déjà.<br />";
}
else if ($check == $dvd_c){
echo "La version collector du dvd existe déjà.<br />";
}
else if (($check<>$dvd_s) && ($check<>$dvd_c)){
header('location:index.php?page=add_dvd');
}
}
?>
<form name='select_dvd' method='POST' action='index.php?page=select_add_dvd'>
<table border="1" style="margin-left:35px" cellpadding = 0 cellspacing= 0>
<colgroup width = "30px"></colgroup>
<colgroup width = "400px"></colgroup>
<colgroup width = "50px"></colgroup>
<colgroup width = "50px"></colgroup>
<colgroup width = "50px"></colgroup>
<tr bgcolor="gold" height="20px">
<td align="center">Ajout</td>
<td align="center">Titre</td>
<td align="center">standard</td>
<td align="center">Collector</td>
<td align="center">Autres</td>
</tr>
<?php
$sql = mysql_query("SELECT id_film, titre FROM films ORDER BY titre");
$nb = mysql_num_rows($sql);
$sqldvd = mysql_query("SELECT id_dvd, id_film, edition FROM films_dvd");
$nbl = mysql_num_rows($sqldvd);
for ($a = 0; $a < $nb; $a++){
$id_film = mysql_result($sql,$a,"id_film");
$titre = mysql_result($sql,$a,"titre");
if ($a % 2) {
$couleur = '#F0F8FF';
} else {
$couleur = 'white';
}
?><tr style="background-color:<?php echo $couleur;?>">
<td align='center'><input type="radio" name="check[]" value="<?php echo $id_film;?>" <?php if (est_selectionne_check("$id_film")) { echo 'checked'; } else if (is_array($check)){ if (in_array("$id_film",$check)) { echo 'checked'; }} ?>></td>
<?php
echo "<td> $titre</td>";
for ($b = 0; $b < $nbl; $b++){
$id_dvd = mysql_result($sqldvd,$b,"id_dvd");
$id_film_dvd = mysql_result($sqldvd,$b,"id_film");
$edition = mysql_result($sqldvd,$b,"edition");
if ($id_film_dvd == $id_film){
if ($edition == 'standard'){
echo "<td><input type='checkbox' name='dvd_s[]' value='$id_film' checked='checked'></td>";
}
else if ($edition == 'collector'){
echo "<td><input type='checkbox' name='dvd_c[]' value='$id_film' checked='checked'></td>";
}
}
else {
echo "<td><input type='checkbox' name='dvd[]' value=''></td>";
}
}
echo "</tr>";
}
echo "<td align='center' colspan=4><input type='submit' name='valider' value='valider'></td></tr></table></form>";
?> |
Partager