So I've created a form on my website, it has one input and when the user fills it it store it in the datebase table, it stores what user wrote.
Now whenever I again type something it adds just one more value to the column and I want to replace the one that is already added. So what I want is when I type for example "Datebase" it will be stored in the MySQL table, but again when I type "Datebase change" in the same input it will just the update the current value and it will be changed from "Datebase" to "Datebase change". So I dont want to add more values I just need this one input which will change what it is on column on every submit.
My code:
<?php
$title = 'Admin Panel - Edit';
include '../config.php';
$heading = mysqli_real_escape_string($link, $_REQUEST['heading']);
// Attempt insert query execution
$sql = "INSERT INTO content (heading) VALUES ('$heading')";
if(mysqli_query($link, $sql)){
echo "Records inserted successfully.";
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
?>
<form action="edit.php">
<input type="text" name="heading" id="heading" />
<input type="submit" value="Submit" name="submit" />
</form>