I've created this code in PHP which includes a form. In this form the user can insert an announcement. To save the datas into database I've created this submit button with the value POSTO
.
But when I fill the form and click the submit button nothing happens and the data is not saved into the database. A lso if I put a wrong name of table it doesn't show error.
Here is my database: database
Here is the PHP code:
<html>
<head>
<title></title>
</head>
<body>
<?php
if( !($database=mysql_connect("localhost","root",""))||!(mysql_select_db("st_login",$database)) )
print("Could not connect");
//postohen announcement
echo "Post announcement";
print("<form><p> <textarea cols='40' rows='30'></textarea> </p>
<input type='submit' name='njoftim' value='Posto'/></form> ");
if(isset($_POST['njoftim'])){
$njoftim=$_POST['njoftim'];
$query="INSERT INTO `njoftime` (njoftim) VALUES ('$njoftim')";
if(!($result=mysql_query($query,$database)))
{
print("Could not execute query");
die (mysql_error());//ose error
}
}
mysql_close($database);
?>
</body>
</html>