Czy ktos mi pomoze i powie dlaczego posty nie sa dodawane do bazy?
<html>
<head>
<title>Forum 3 grupy WSIiE</title>
</head>
<body>
<h2>!! FoRuM DySkuSyJnE !!</h2>
<a href="main.php">Wszystkie posty</a>,
<a href="nowy_post.php">Nowy post</a><hr>
<?php
//wyswietla formularz i przyjmuje dane, wpisujac nowy post do bazy.
$polaczenie=pg_connect ("host=127.0.0.1 dbname=postgres user=ls password=ddd3") or
die ("Nie można połączyć z PostgreSQL");
if ($_POST['co']=='wyslij'){
if ($tytul && $osoba && $tresc){ //dopisujemy
$zapisz = pg_query("INSERT INTO forum (osoba, tytul , tresc, data, ref) VALUES ('$osoba', '$tytul', '$tresc', now(),'".$_GET['ref']."')");
print 'Wpis został dokonany.<a href="main.php">Księga gości</a>'; } else {
$tresc2=$_POST['tresc'];
$tytul2=$_POST['tytul'];
$osoba2=$_POST['osoba'];
}
} elseif ($_GET['ref']>0){
$wynik = pg_query ($polaczenie, "SELECT osoba, tytul, tresc, data "."FROM forum WHERE nr=".$_GET['ref']); $tresc = $rekord['tresc']; $tytul = $rekord['tytul'];
$tresc = str_replace ("\n", "\n: ", $tresc); $tresc = ": ".$tresc; if (!(ereg("^Re: ", $tytul))){ $tytul = "Re: ".$tytul;
}
print "<H3>Odpowiedz na post: ".$rekord['tytul']."</H3><P>Wysłany przez "; print "<b>".$rekord['osoba']."</b>,<b>".$rekord['data']."</b></P>".$rekord['tresc']."<br><hr>";
}
}
//grafika od formularza
print "<h3>Wyślij post:</h3>"; print "<form method=post><input type=\"hidden\" name=\"co\" value=\""; print "wyslij\"><input type=\"hidden\" name=\"ref\" value=\"".$_GET['ref']."\">"; print "<b>Osoba:</b><br><input type=\"text\" name=\"osoba\" "; print "<input type=\"text\" name=\"tytul\" value=\"$tytul\" "; print "size=60><br><b>tresc:</b><br><textarea name=\"tresc\" "; print "rows=10 cols=60>$tresc</textarea><br>\n"; print "<input type=\"submit\" value=\"Wyslij\">"; ?>
</body>
</html>