I'm attempting to create a simple admin page for a website. Where the content from the form below, will populate within the p tags in the html doc
<html>
<body>
<form action="write.php" method="post">
Site Description: <input type="text" name="Description">
<input type="submit">
</form>
</body>
</html>
write.php
<?php
$con=mysqli_connect("BlahBlah","website","password","db");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql="INSERT INTO Site (Description)
VALUES
('$_POST[Description]')";
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
echo "1 record added";
mysqli_close($con);
?>
index.html
<html><head></head><body>
<div id="description><h1>Title</h1>
<p class="body">INFORMATION FROM FORM DISPLAYED HERE</p>
</body></html>
I'm new to sql, any help will be appreciated. Thanks