XML; $xml = new SimpleXMLElement($xmlstr); fwrite($file, $xml->asXML()); unset($xmlStr, $xml); fclose($file); } ?>

Guestbook

addChild("input"); $input->addAttribute("input", htmlspecialchars(utf8_encode($_POST['input']))); $input->addAttribute("subject", htmlspecialchars(utf8_encode($_POST['subject']))); $input->addAttribute("name", htmlspecialchars(utf8_encode($_POST['name']))); $input->addAttribute("time", time()); $file = fopen($filename, "wb"); fwrite($file, $xml->asXML()); unset($xml, $input); fclose($file); echo "Entrie added..."; } ?>
Name:
Subject:



input as $i) { $array[] = $i; } $array = array_reverse($array); foreach($array as $i) { $i['name'] = utf8_decode((string)$i['name']); $i['subject'] = utf8_decode((string)$i['subject']); $i['input'] = utf8_decode((string)$i['input']); echo "Name: {$i['name']}
"; echo "Subject: {$i['subject']}
"; echo "Date: "; echo date("l dS \of F Y h:i:s A", (int)$i['time']); echo "
"; echo $i['input']; echo "


"; } ?>