Chapter 6 movie.php
A duplicated data in the select input,
<?php
// select the movie type information
$query = 'SELECT
movietype_id, movietype_label
FROM
movietype
ORDER BY
movietype_label';
$result = mysql_query($query, $db) or die(mysql_error($db));
// populate the select options with the results
while ($row = mysql_fetch_assoc($result)) {
foreach ($row as $value) {
if ($row['movietype_id'] == $movie_type) {
echo '<option value="' . $row['movietype_id'] .
'" selected="selected">';
} else {
echo '<option value="' . $row['movietype_id'] . '">';
}
echo $row['movietype_label'] . '</option>';
}
}
?>
any help thanks
|