Plik index.php
require('connect.php'); if($_GET['menu'] == 'dodaj') { echo <<< dodaj <form action="" method="POST"> <h2>Dodawanie News'a.</h2> dodaj; { $tytul = $_POST['tytul']; $opis = $_POST['opis']; $autor = $_POST['autor']; $tresc = $_POST['tresc']; { } else { $dodaj = mysql_query("INSERT INTO `newsy` (`tytul`, `opis`, `autor`, `data`, `tresc`) VALUES ('".$tytul."', '".$opis."', '".$autor."', '".$data."', '".$tresc."')"); if($dodaj) { } else if(!$dodaj) { } } } echo <<< dodaj <h3>Tytuł:</h3> <input type="text" name="tytul" size="30" maxlength="30"> <h3>Opis:</h3> <input type="text" name="opis" size="30" maxlength="35"> <h3>Autor:</h3> <input type="text" name="autor" value="$_SESSION[logowanie]" size="30" maxlength="10"> <h3>Treść Newsa:</h3> <textarea cols="57" rows="15" name="tresc" /></textarea> </br> <input value="Dodaj Newsa" name=dodaj type="submit"><button type="reset">Reset</button> </form> dodaj; }
plik connect.php