Chciałem zrobić prosty system newsów, ale niestety mam problem. Otóż, chodzi o to, że wypełniam wszystkie pola, klikam dodaj, ale w bazie nic nowego się nie pojawia. Oto kod (wiem, że może być źle napisany, ale nie jestem geniuszem w tym temacie, inaczej nie wpisywałbym się w dziale przedszkole

<?php $dbhost = 'host'; $dbuser = 'user'; $dbpass = 'pass'; if(! $conn ) { } $tytul=$_POST['tytul']; $wstep=$_POST['wstep']; $calosc=$_POST['calosc']; $autor=$_POST['autor']; { } else { $sql = "INSERT INTO newsy ". "(id, tytul, wstep, calosc, autor, data) ". "VALUES ". "('', '$tytul', '$wstep', '$calosc', '$autor', now())"; } ?>
I formularz:
<form method="post" action="<?php $_PHP_SELF ?>"> <table align="center" width="400" border="0" cellspacing="1" cellpadding="2"> <tr> </tr> <tr> <td> <input name="tytul" type="text" id="tytul"> </td> </tr> <tr> </tr> <tr> <td> </td> </tr> <tr> </tr> <tr> <td> </td> </tr> <tr> </tr> <tr> <td> <input name="autor" type="text" id="autor"> </td> </tr> <tr> <td> <input name="add" type="submit" id="add" value="Dodaj newsa"> </td> </tr> </table> </form>