<html><body>
 <?php
   require("teatekonf.php");
   mysql_connect($masin, $kasutajanimi, $parool);
   mysql_select_db($baasinimi);
   if(isSet($nimi) && isSet($teatesisu)){
     mysql_query("INSERT INTO teated2 (nimi, teade) ".
      "values('$nimi', '$teatesisu')"); 
   }
   $vastus=mysql_query("SELECT nimi, teade FROM teated2");   
   if($vastus){
      echo "<h2>Teated</h2>\n";
      echo "<table>\n";
      while($rida=mysql_fetch_array($vastus)){
        echo "<tr><td><b>".$rida["nimi"]."</b></td>".
             "<td>".$rida["teade"]."</td></tr>\n";
      }
      echo "</table>";
   }
   mysql_close();
 ?>
 <form>
  <table>
   <tr>
    <td>Nimi:   </td><td><input type="text" name="nimi" size="50"></td>
   </tr><tr>
    <td>Teade:  </td><td><input type="text" name="teatesisu" size="50"></td>
   </tr><tr>
    <td colspan="2" align="center"><input type="submit" value=" Saada "></td>
   </tr>
  </table>
 </form>     
</body></html>