I have a form on my website, that creates a post from front end. So every time when I refresh a page I got this message first:
The page that you're looking for used information that you entered. Returning to that page might cause any action you took to be repeated. Do you want to continue?
If page is refreshed then previous action is done that is post with same entries as is in previous post is created. CODE is::
<form action="" method="post" name="story_form" onsubmit="return vedioform()" enctype="multipart/form-data">
<label>Add link to your video</label><br />
<input type="text" class="input-big" name="cntnt"/>
<label>Name</label><br />
<input type="text" class="input-box" name="fname" />
<label>Email</label><br />
<input type="text" class="input-box" name="email" />
<label>Your Wix website</label><br />
<input type="text" class="input-box" name="title"/>
Excerpt::<input type="text" class="input-box" name="excerpt"/>
custom:::<input type="text" class="input-box" name="custom"/>
<label>Your picture (Type: jpeg, jpg, png, gif)</label><br />
<input type="file" size="60" id="BrowserHidden" onchange="getElementById('FileField').value = getElementById('BrowserHidden').value;" name="thumbnail"/>
<input type="text" id="FileField" name="filefield" />
<input type="submit" class="form-submit" id="submit" value="SUBMIT" name="submit-video"/><br />
</form>
<?php
$title = $_POST['title']; //from your form...
$content=$_POST['cntnt'];
$excerpt=$_POST['excerpt'];
$custom = $_POST['custom'];
//-- Set up post values
$myPost = array(
'ID' => '',
'post_title' => $excerpt,
'post_excerpt' => $excerpt,
'post_status' => 'publish',
'post_type' => 'post',
'post_author' => $authorID,
'post_content' =>$content,
'comment_status' => 'closed',
'ping_status' => 'closed',
'post_category' => array('7'),
);
$new_post = wp_insert_post( $myPost);
add_post_meta($new_post, 'rating', $custom, true);
?>