Hi, I am quite new to web building. I have below code but my Insert query does not Insert anything in my database. It does not show any error and work well in local host.
<?php
$con=mysqli_connect('localhost','id5253788_njb','*********','id5253788_njb');
mysqli_select_db($con,'id5253788_njb')or die("cannot select DB");
if(mysqli_connect_errno($con)){
echo "Could not connect to the db:". mysqli_connect_error();
}
?>
<form action='' method='POST'>
<textarea name='replymsg'></textarea>
<button name='reply'>Reply</button>
</form>
<?php
if (isset($_POST['reply'])){
$bodymsg=$_POST['replymsg'];
$sql="INSERT INTO msg (tomsg, toname, frommsg, fromname, bodymsg) VALUES ('tomsg', 'toname', 'frommsg', 'fromname', '$bodymsg')";
$query=mysqli_query($con,$sql);
echo "Message Sent";
}
mysqli_close($con);
?>
</html>
Can anyone help me out?