<?
// edit.php met dank aan Dennis van www.sitemasters.be!!
include "config.php";
if (isset($_POST["Submit"])){ //als de persoon op Submit heeft gedrukt...
$query="UPDATE reviews SET //tabelnaam is formulier
auteur = '". $_POST['auteur'] ."',
email = '". $_POST['email'] . "',
titel = '". $_POST['titel'] . "',
genre = '". $_POST['genre'] . "',
jaartal = '". $_POST['jaartal'] . "',
rating = '". $_POST['rating'] . "',
verhaal = '". $_POST['verhaal'] . "',
review = '". $_POST['review'] . "',
mening = '". $_POST['mening'] . "',
WHERE id='" .$_POST['id'] ."'";
//als er iets fout is gebeurt dan...
echo("De volgende opdracht is uitgevoerd: <b>$query</b><br>\n"); if ($result){
echo ("De review is met succes veranderd!<br>\n"); echo ("<a href=\"index.php\">Terug naar de index</a>"); //nu gaat hij naar index.php }
}else{
?>
<html>
<head>
<title>Bewerk review</title>
</head>
<body>
<font size="1" face="Verdana, Arial, Helvetica, sans-serif">Review wijzigen</font>
<?
$sql = mysql_query("SELECT * FROM reviews where id=$id"); ?>
<!-- Hier staat het formulier waarmee je de review aanpast -->
<form action="
<?php echo($_SERVER["PHP_SELF"]);?
>" method="post"> <font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<input type="hidden" name="bevestiging" value="1">
<input type="hidden" name="id" value="
<?php echo($_GET["id"]);?
>">
Auteur: <br>
<input type="text" name="auteur" value="
<?php echo $result[auteur
];?
>" size="30">
<br>
E-mail adres v/d auteur: <br>
<input type="text" name="email" value="
<?php echo $result[email
];?
>" size="30">
<br>
Titel v/d film: <br>
<input type="text" name="titel" value="
<?php echo $result[titel
];?
>" size="30">
<br>
Genre:<br> <Select name="genre" value="
<?php echo $result[genre
];?
>">
<option value='Aktie/Avontuur'>Aktie/Avontuur</option>
<option value='Animatie'>Animatie</option>
<option value='Comedie'>Comedie</option>
<option value='Drama'>Drama</option>
<option value='Horror/Thriller'>Horror/Thriller</option>
<option value='Science Fiction'>Science Fiction</option>
<option value='Western'>Western</option>
<option value='Overig'>Overig</option></select><br>
<br>
Jaartal:<br> <Select name="jaartal" value="
<?php echo $result[jaartal
];?
>">
<option value='onbekend'>onbekend</option>
<option value='2004'>2004</option>
<option value='2003'>2003</option>
<option value='2002'>2002</option>
<option value='2001'>2001</option>
<option value='2000'>2000</option>
<option value='1999'>1999</option>
<option value='1998'>1998</option>
<option value='1997'>1997</option>
<option value='1996'>1996</option>
<option value='1995'>1995</option>
<option value='1994'>1994</option>
<option value='1993'>1993</option>
<option value='1992'>1992</option>
<option value='1991'>1991</option>
<option value='1990'>1990</option>
<option value='1989'>1989</option>
<option value='1988'>1988</option>
<option value='1987'>1987</option>
<option value='1986'>1986</option>
<option value='1985'>1985</option>
<option value='1984'>1984</option>
<option value='1983'>1983</option>
<option value='1982'>1982</option>
<option value='1981'>1981</option>
<option value='1980'>1980</option>
<option value='1979'>1979</option>
<option value='1978'>1978</option>
<option value='1977'>1977</option>
<option value='1976'>1976</option>
<option value='1975'>1975</option>
<option value='1974'>1974</option>
<option value='1973'>1973</option>
<option value='1972'>1972</option>
<option value='1971'>1971</option>
<option value='1970'>1970</option>
<option value='Prehistorisch'>Prehistorisch</option></select><br>";
<br>
Rating:<br> <input type="text" name="rating" value="
<?php echo $result[rating
];?
>"><br>
<br>
Verhaal:<br> <textarea name="verhaal" value=" rows="7" cols="50">
<?php echo $result[verhaal
];?
></textarea><br>
<br>
Review:<br> <textarea name="review" value=" rows="7" cols="50">
<?php echo $result[review
];?
></textarea><br>
<br>
Eigen mening:<br> <textarea name="mening" value=" rows="7" cols="50">
<?php echo $result[mening
];?
></textarea><br>
<br>
</font>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="Submit" value="Sla de bewerkte review op">
<input type="Button" value="Vorige pagina" onclick="javascript:history.back();">
</font>
</form>
<?php
}
?>
</body>
</html>