wouter54321
Gebruiker
- Lid geworden
- 24 mei 2008
- Berichten
- 218
Hallo, ik heb dit script:
Mysql database:
Het script:
gastconfig.php
gastverwerk.php
gastbericht.php
gastberichten.php
Ik heb dus dit script maar nu moeten de gasten reacties kunnen geven.
Wilt er iemand dit erbij maken of hoe doe ik dit?
Alvast bedankt.
Mysql database:
PHP:
CREATE TABLE `gastenboek` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`naam` VARCHAR( 255 ) NOT NULL ,
`boodschap` TEXT NOT NULL
)
Het script:
gastconfig.php
PHP:
<?php
$hostname = "localhost";
$username = "root";
$password = "";
$database = "gastenboek";
mysql_connect($hostname,$username,$password) or die(mysql_error());
mysql_select_db($database);
?>
gastverwerk.php
PHP:
<?php
include ('gastconfig.php');
$naam = $_POST['naam'];
$boodschap = $_POST['boodschap'];
$sql = "INSERT INTO gastenboek(naam, boodschap)
VALUES ('".$naam."','".$boodschap."')";
mysql_query($sql) or die (mysql_error());
?>
gastbericht.php
PHP:
<form method="POST" action="gastverwerk.php">
<input type="text" name="naam">
<textarea name="boodschap"></textarea>
<input type="submit" value="Verzend">
</form>
gastberichten.php
PHP:
<?php
include('gastconfig.php');
$sql = 'SELECT * FROM gastenboek ORDER BY id DESC';
$res = mysql_query($sql);
while($row = mysql_fetch_assoc($res))
{
echo $row['naam'] . ':<br><br>';
echo nl2br($row['boodschap']);
echo '<hr>';
}
?>
Ik heb dus dit script maar nu moeten de gasten reacties kunnen geven.
Wilt er iemand dit erbij maken of hoe doe ik dit?
Alvast bedankt.