I have the form with textarea field like this:
<form action="post.php" method="post" accept-charset="utf-8" id="myForm">
<textarea name="content" rows="10" cols="60"></textarea>
<input name="submit" type="submit" value="submit" />
</form>
I do the query to insert the values into the table like this:
$q = "INSERT INTO tableName (x, y, x) VALUES (1, a, b)";
$r = $mysqli->query($q);
if ($mysqli->affected_rows == 1) {
echo '<p>Your post has been entered.</p>';
} else {
echo '<p>Your post could not be handled due to a system error.</p>';
}
Assumed that the form was submitted successfully, and the message returned your post has been entered.
Nothing to say if the users who used the form to submit the values leave the page immediately right after that. However, the issue is that if he/she reloads the current page (by refreshing the browser) to submit it again and over again, the same values get inserted into the table, `which I do not want to'.
Can you help me to clear the value of the textarea field so that the form could not be re-submitted (due to the form validation), using php?
Thanks