<?php
mysql_connect("localhost","root","");
mysql_select_db("noyztvs");
if(isset($_POST['rasyti']))
{
$pavadinimas = $_POST['pavadinimas'];
$naujiena = $_POST['naujiena'];
$gauti = mysql_query("INSERT INTO naujienos (pavadinimas, naujiena)VALUES('$pavadinimas','$naujiena')");
$tikrinam = mysql_affected_rows();
if($tikrinam == 1)
{
echo "Naujiena sekmingai prideta";
}
}
else
{
echo '<form action="" method="post">';
echo "Pavadinimas : <br><input type='text' name='pavadinimas'>";
echo "<br>Naujiena : <br><textarea name='naujiena' rows='4' cols='20' class='textbox' style='width:300px'></textarea><br />\n";
echo "<br><input type='submit' name='rasyti'>";
echo '</form>';
echo "<br>Klaida";
}