Oki zrobilem komentarze, wszystko jest git, tylko dwa razy trzeba kliknac dodaj, zeby wyswietlilo komentarz, gdzie moze byc blad? Oto kod:
zdjecie.php
<?php
$zdjecie=$_GET['ktore'];
$_SESSION['zdjecie']=$_GET['ktore'];
echo "<img src=".$zdjecie.">"; $zdjecie = $_SESSION['zdjecie'];
$login = $_SESSION['login'];
$comment = $_POST['Comment'];
$godzina = date("H:i:s");
?>
<HTML>
<BODY>
<BR>
<?php
$xml = simplexml_load_file('comments.xml');
foreach($xml->children() as $child)
if($child->zdjecie==$zdjecie)
{
"<B>".$child->login."</B>"." ".
$child->godzina." "." ",
$child->data." "."<BR>",
$child->comment."<BR>",
$child['type']."\n";
}
echo '<form method="post"><BR>'; echo '<B>Komentarz:</B>'; echo '<BR><textarea name="Comment" id="adres" cols="25" rows="4"></textarea><BR>'; echo '<input name="submit" type="submit" value="Dodaj">'; echo '<input type="reset">';
if($login && $comment)
{
$xml = new DOMDocument();
$xml->load('comments.xml');
$xel = $xml->documentElement;
$image = $xml->createElement('image');
$zdjecie = $xml->createElement('zdjecie',$zdjecie);
$login = $xml->createElement('login',$login);
$comment = $xml->createElement('comment',$comment);
$data = $xml->createElement('data',$data);
$godzina = $xml->createElement('godzina',$godzina);
$image->appendChild($zdjecie);
$image->appendChild($login);
$image->appendChild($comment);
$image->appendChild($data);
$image->appendChild($godzina);
$xel->appendChild($image);
$xml->save('comments.xml');
}
?>
</body>
</html>