<?php
  
echo "<?xml version=\"1.0\"?>";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>
      Gjestebok
    </title>
    <meta http-equiv="Content-Type"
    content="text/html; charset=utf-8" />
  </head>
  <body>
<?php
    
require ('guestbook.class.php');
    require (
'hilsen.class.php');

    
//$gjestebok->printFile();
if((isset($_POST['tittel']) ? $_POST['tittel'] : '') && (isset($_POST['tekst']) ? $_POST['tekst'] : '')) {
    
//var_dump($_POST);
    
$hilsen = new hilsen($_POST['tittel'], $_POST['tekst'], $_POST['web']);
    
$gjestebok = new guestbook('gjestebok.xml');
    
$gjestebok->readFile();
    
$gjestebok->addToFile($hilsen);

    echo 
"Takk for din hilsen";
}
else {
    echo 
"B&aring;de feltene navn og hilsen m&aring; v&aelig;re utfylte";
}
?>
   <a href="gjestebok_vis.php">Tilake til gjesteboka</a> 
</body>
</html>