formularz do zbierania danych
<html> <head> <title>Wysylanie Newsow</title> </head> <body> <? include 'config.php'; ?> <form name = "newsy" action = "http://127.0.0.1/~php/submit.php" method = "POST" > <table> <tr> <td>Tytul</td> <td><input type="text" name="tytul"></td> </tr> <tr> <td>Tresc Newsa</td> <td><input type="text" name="tresc"></td> </tr> <tr> <td><input type="submit" value="Wyślij"></td> </table> </form> </body> </html>
plik wysylajace dane
<html> <head> <title>Wyslanie Newsa</title> </head> <body> <? include 'config.php'; echo "<html>n<head>n<title>Blad</title>n</head>nn<body><h1 align="center">Blad</h1>n<p>Nie wypelniles pola <b>Tytuł</b> i/lub <b>TRESC</b></p>"; exit; } $query = "insert into News values ('$tytul', '$tresc')"; ?> Dziękujemy za dodanie ogloszenia. Kliknij <a href="index.php">tutaj</a> aby zobaczyć stronę główną. </body> </html>