de hele zooi komt niet in de database terecht heeft iemand een idee?
hier de code:
//add.php
<?php
mysql_connect('*****', '*****', '******') or die (mysql_error());
mysql_select_db('*****');
if(isset($_POST['news']))
{
$toevoegen = 'INSERT INTO news SET gb_name = "'.$_POST['gb_name'].'",title = "'.$_POST['title'].'",message = "'.$_POST['message'].'"';
mysql_query($toevoegen) or die (mysql_error());
echo 'Message introduced';
}
echo '<a href="index.php">Index</a>';
echo '<form action="" method="post">';
echo 'Title:<input type="text" name="gb_name">';
echo '<br />';
echo 'Title:<input type="text" name="title">';
echo '<br />';
echo 'Message:<textarea name="message" rows="10" cols="30">';
echo '</textarea>';
echo '<br />';
echo '<br />';
echo '<input type="submit" value="Submit">';
echo '<br />';
?>
//index.php
<?php
mysql_connect('*****', '*****', '*****') or die (mysql_error());
mysql_select_db('*****'); // database connectie
$query = 'SELECT * FROM news';
$result = mysql_query($query) or die('Fout bij uitvoeren van de query');
echo '<table>';
while ($row = mysql_fetch_assoc($result))
{
echo '<tr>';
echo '<a href="add.php>Add message</a>"';
echo '<a href="admin_add.php>Admin</a>';
echo '<td>'.$row['gb_name'].'</td>';
echo '<td>'.$row['title'].'</td>';
echo '<td>'.$row['message'].'</td>';
echo '<td>'.$row['opmerking'].'</td>';
echo '<td><a href="add.php?id='.$row['id'].'">Edit</a></td>';
echo '</tr>';
}
echo '</table>';
?>
<html>
<body>
hoi
</body>
</html>