Foutmelding: niet genoeg ingevult
Code:
Code (php)
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
64
65
66
67
68
69
70
71
72
73
74
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
64
65
66
67
68
69
70
71
72
73
74
<?
include "config.php";
if ($_POST[submit]) {
if ($_POST['auteur'] == "" || $_POST['email'] == "" || $_POST['titel'] == "" || $_POST['genre'] == "" || $_POST['jaartal'] == "" || $_POST['rating'] == "" || $_POST['review'] == "" )
{
echo "Je hebt niet alles ingevuld!<br><a href=\"javascript:history.go(-1)\">Klik hier om terug te gaan</a>";
}
else {
$insert = "INSERT INTO reviews (id, auteur, email, titel, genre, jaartal, rating, review, kliks) VALUES ('', '$_POST[auteur]', '$_POST[email]', '$_POST[titel]', '$_POST[genre]', '$_POST[jaartal]', '$_POST[rating]', '$_POST[review]')";
$query = mysql_query($insert);
echo "De review is succesvol toegevoegd!<br>Klik <a href=\"reviews.php\">hier</a> om naar de reviews te gaan";
}
}
else
{
echo "Voeg hier een review toe!";
echo "<form method=\"POST\" action=\"toevoegen.php\">";
echo "<table>";
echo "<tr><td>Je (nick)naam:</td><td><input type=\"text\" name=\"auteur\"></td></tr>";
echo "<tr><td>Email:</td><td><input type=\"text\" name=\"email\"></td></tr>";
echo "<tr><td>Titel van de film:</td><td><input type=\"text\" name=\"script\"></td></tr>";
echo "<tr><td>Genre:</td><td><Select name=\"genre\">
<option>Aktie/Avontuur</option>
<option>Animatie</option>
<option>Comedie</option>
<option>Horror/Thriller</option>
<option>Science Fiction</option>
<option>Anders</option></select></td></tr>";
echo "<tr><td>Jaartal:</td><td><Select name=\"jaartal\">
<option>1970</option>
<option>1971</option>
<option>1972</option>
<option>1973</option>
<option>1974</option>
<option>1975</option>
<option>1976</option>
<option>1977</option>
<option>1978</option>
<option>1979</option>
<option>1980</option>
<option>1981</option>
<option>1982</option>
<option>1983</option>
<option>1984</option>
<option>1985</option>
<option>1986</option>
<option>1987</option>
<option>1988</option>
<option>1989</option>
<option>1990</option>
<option>1991</option>
<option>1992</option>
<option>1993</option>
<option>1994</option>
<option>1995</option>
<option>1996</option>
<option>1997</option>
<option>1998</option>
<option>1999</option>
<option>2000</option>
<option>2001</option>
<option>2002</option>
<option>2003</option>
<option>2004</option>
</select></td></tr>";
echo "<tr><td>Rating:</td><td><input type=\"text\" name=\"rating\"></td></tr>";
echo "<tr><td>Review:</td><td><textarea name=\"review\" rows=\"7\" cols=\"50\"></textarea></td></tr>";
echo "<tr><td></td><td><input type=\"submit\" name=\"submit\" value=\"Voeg de review toe!\"></td></tr>";
echo "</table></form>";
}
?>
include "config.php";
if ($_POST[submit]) {
if ($_POST['auteur'] == "" || $_POST['email'] == "" || $_POST['titel'] == "" || $_POST['genre'] == "" || $_POST['jaartal'] == "" || $_POST['rating'] == "" || $_POST['review'] == "" )
{
echo "Je hebt niet alles ingevuld!<br><a href=\"javascript:history.go(-1)\">Klik hier om terug te gaan</a>";
}
else {
$insert = "INSERT INTO reviews (id, auteur, email, titel, genre, jaartal, rating, review, kliks) VALUES ('', '$_POST[auteur]', '$_POST[email]', '$_POST[titel]', '$_POST[genre]', '$_POST[jaartal]', '$_POST[rating]', '$_POST[review]')";
$query = mysql_query($insert);
echo "De review is succesvol toegevoegd!<br>Klik <a href=\"reviews.php\">hier</a> om naar de reviews te gaan";
}
}
else
{
echo "Voeg hier een review toe!";
echo "<form method=\"POST\" action=\"toevoegen.php\">";
echo "<table>";
echo "<tr><td>Je (nick)naam:</td><td><input type=\"text\" name=\"auteur\"></td></tr>";
echo "<tr><td>Email:</td><td><input type=\"text\" name=\"email\"></td></tr>";
echo "<tr><td>Titel van de film:</td><td><input type=\"text\" name=\"script\"></td></tr>";
echo "<tr><td>Genre:</td><td><Select name=\"genre\">
<option>Aktie/Avontuur</option>
<option>Animatie</option>
<option>Comedie</option>
<option>Horror/Thriller</option>
<option>Science Fiction</option>
<option>Anders</option></select></td></tr>";
echo "<tr><td>Jaartal:</td><td><Select name=\"jaartal\">
<option>1970</option>
<option>1971</option>
<option>1972</option>
<option>1973</option>
<option>1974</option>
<option>1975</option>
<option>1976</option>
<option>1977</option>
<option>1978</option>
<option>1979</option>
<option>1980</option>
<option>1981</option>
<option>1982</option>
<option>1983</option>
<option>1984</option>
<option>1985</option>
<option>1986</option>
<option>1987</option>
<option>1988</option>
<option>1989</option>
<option>1990</option>
<option>1991</option>
<option>1992</option>
<option>1993</option>
<option>1994</option>
<option>1995</option>
<option>1996</option>
<option>1997</option>
<option>1998</option>
<option>1999</option>
<option>2000</option>
<option>2001</option>
<option>2002</option>
<option>2003</option>
<option>2004</option>
</select></td></tr>";
echo "<tr><td>Rating:</td><td><input type=\"text\" name=\"rating\"></td></tr>";
echo "<tr><td>Review:</td><td><textarea name=\"review\" rows=\"7\" cols=\"50\"></textarea></td></tr>";
echo "<tr><td></td><td><input type=\"submit\" name=\"submit\" value=\"Voeg de review toe!\"></td></tr>";
echo "</table></form>";
}
?>
Quote:
|| $_POST['titel'] == ""
En dat terwijl dat veld (titel) helemaal niet in het formulier voorkomt (die heet daar 'script')....
Overigens is de functie empty() mooier. Dus:
Elwin
[Edit: Typo]
Gewijzigd op 16/05/2004 22:13:00 door Elwin - Fratsloos
YES! Het werkt nu, (wel dom dat ik dat nie gezien heb :P) Bedankt he Elwin! Nu alleen nog ff zo'n review pagina maken (word ook nog lekker ruzieen met php :P)
Ik ben nu bezig met een pagina waarin de resultaten worden weergegeven. Maar de code werkt niet. Wat moet er veranderd worden?
code:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?
include "config.php";
$sql = mysql_query("SELECT titel,id FROM reviews ORDER BY titel ASC");
while($select = mysql_fetch_assoc($sql)){
echo '<a href="lees.php?id='.$select['id'].'">'.$select['titel'].'</a><br>';
}
{
$sql = mysql_query("SELECT * FROM reviews where id=$_get[id]");
$result= mysql_fetch_array($sql);
echo ("$result[titel] $result[review] $result[rating]");
}
?>
include "config.php";
$sql = mysql_query("SELECT titel,id FROM reviews ORDER BY titel ASC");
while($select = mysql_fetch_assoc($sql)){
echo '<a href="lees.php?id='.$select['id'].'">'.$select['titel'].'</a><br>';
}
{
$sql = mysql_query("SELECT * FROM reviews where id=$_get[id]");
$result= mysql_fetch_array($sql);
echo ("$result[titel] $result[review] $result[rating]");
}
?>
- Komt er een foutmelding?
- Zo ja, welke?
- Staat er iets op het scherm? (dus al output van het script)
- Zo ja, wat?
Elwin
is al opgelost. Het systeem werkt nu, bedankt voor de hulp in ieder geval