Title: insert into table and refresh issue
Last modified: August 19, 2016

---

# insert into table and refresh issue

 *  [no_ob](https://wordpress.org/support/users/no_ob/)
 * (@no_ob)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/insert-into-table-and-refresh-issue/)
 * Hi All,
 * I have written a little piece of code that will insert a word into a wp custom
   db table after submit in wp admin panel.
 * Now when i hit F5, it will insert the data a second time. How can i solve this
 *     ```
       if (!empty($_POST['add_bcw']) && ($_POST['add'] == 'add_word')) {
   
       $insert_data = "INSERT INTO " . wp_badcommentswords . " (bcw_name) " .
       	  "VALUES ('" . $_POST['add_bcw'] . "')";
       $results = $wpdb->query($insert_data);
       }
       ```
   
 * How do i solve this ?

Viewing 1 replies (of 1 total)

 *  Thread Starter [no_ob](https://wordpress.org/support/users/no_ob/)
 * (@no_ob)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/insert-into-table-and-refresh-issue/#post-1441764)
 * I’ve created the table as
    `bcw_name varchar(255) NOT NULL UNIQUE,`
 * Is this a valid way to keep double entry’s out of here ? It works, but is it 
   a valid way ?

Viewing 1 replies (of 1 total)

The topic ‘insert into table and refresh issue’ is closed to new replies.

 * 1 reply
 * 1 participant
 * Last reply from: [no_ob](https://wordpress.org/support/users/no_ob/)
 * Last activity: [16 years, 2 months ago](https://wordpress.org/support/topic/insert-into-table-and-refresh-issue/#post-1441764)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
