Het volgende script heeft een foutmelding:
Parse error: syntax error, unexpected '}' in C:\wamp\www\a\news.php on line 109
Uitleg over hoe ik tewerk ging:
Dit deel dient om een comment te adden op een newspost
1)Eerste If clause: is er op de submit knop gedrukt, maw zijn er gegevens ingevoert
2)gegevens ophalen ff controleren of ze ingevult zijn etc
3)a. Foutmelding geven
3)b. Gegevens ingeven
______________________________________
______________________________________
<?php if (isset($_POST['submit'])) {
$naam = nl2br($_POST["naam"]);
$email = nl2br($_POST["email"]);
$nid = $_POST["nid"];
$reactie = nl2br($_POST["reactie"]);
if ($reactie=="")
{ $error=$error."<table cellspacing='0' width='90%'><tr><td align='center'>Please fill in the comment form.</td></tr></table>\n"; }
else { }
if ($naam=="")
{ $error=$error."<table cellspacing='0' width='90%'><tr><td align='center'>Please fill in the comment form.</td></tr></table>\n"; }
else { }
if ($email=="")
{ $error=$error."<table cellspacing='0' width='90%'><tr><td align='center'>Please fill in the comment form.</td></tr></table>\n"; }
else { }
if ($error) { ?>
<table border="1" cellspacing='0' style='border-collapse: collapse;' cellpadding='0' cellspacing='0' width='90%'>
<tr>
<td><strong>Comments:</strong></td>
</tr>
<tr>
<td><?php echo $error; ?></td>
</tr>
</table>
<?php
}else{
$query="INSERT INTO newsreacties (nid, naam, email, reactie) VALUES ('$id', '$naam', '$email', '$reactie');";
mysql_query($query) or die(mysql_error());
?>
<table border="0" cellspacing='0' style='border-collapse: collapse;' cellpadding='0' cellspacing='0' width='90%'>
<tr>
<td><strong>Comments:</strong></td>
</tr>
<tr>
<td align='center'>Comment added succesfull, $naam !<br><a href='<?php echo $_SERVER["REQUEST_URI"]; ?>'>Click here</a> to go back to the newspost.
</td>
</tr>
</table>
<?php
}
}else{
echo "<form action='' method='post'>\n";
echo "<table border='0' bordercolor='#000000' cellspacing='0' style='border-collapse: collapse;' cellpadding='0' cellspacing='0' width='90%'>\n";
echo " <tr>\n";
echo " <td><strong>Comments:</strong></td>\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td>\n";
echo " <table border='0' cellpadding='0' cellspacing='0' width='100%'>\n";
echo " <tr>\n";
echo " <td width='120' valign='top'>Name:</td>\n";
echo " <td width='250'> <input name='naam' type='text id='naam' size="20">\n";
echo " </tr>\n";
echo " <tr>\n";
echo " <td width='120' valign='top'>Email:</td>\n";
echo " <td width='250'> <input name='email' type='text id='naam' size="50">\n";
echo " </tr>\n";
echo " <td width='120' valign='top'>Comments:</td>\n";
echo " <td width='250'><textarea name='reactie' rows='4' cols='50'></textarea></td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " <center><input type='hidden' value='$id' name='nid'><input type='submit' value='Add' name='submit'> <input type='reset' value='Reset' name='reset'></center>\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";
echo "</form>\n";
echo "<br><br><center><a href='index.php?page=news'>Go back</a></center>";
}
934 views