Title: Form retaining session variables.
Last modified: August 20, 2016

---

# Form retaining session variables.

 *  Resolved [Gaurav Ganeriwala](https://wordpress.org/support/users/gauravganeriwala/)
 * (@gauravganeriwala)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/form-retaining-session-variables/)
 * So I made a custom form with functions to show an error message
    if the mandatory
   input areas were left empty. But after the form is submitted once, it apparently
   retains the values in $_POST[‘name_of_element’] rendering the whole checking 
   process useless.
 * I tried adding a session_destroy(); at submission but that leads to a php error
   claiming that no session was initiated.
 * Any help with this would be much appreciated. I just need the $_POST variables
   to be cleared when the functions have completed.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [Gaurav Ganeriwala](https://wordpress.org/support/users/gauravganeriwala/)
 * (@gauravganeriwala)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/form-retaining-session-variables/#post-3369570)
 * Nevermind. Found a resolution.
 *  Thread Starter [Gaurav Ganeriwala](https://wordpress.org/support/users/gauravganeriwala/)
 * (@gauravganeriwala)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/form-retaining-session-variables/#post-3369571)
 * Nevermind. Found a resolution.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Form retaining session variables.’ is closed to new replies.

## Tags

 * [destroy](https://wordpress.org/support/topic-tag/destroy/)
 * [form](https://wordpress.org/support/topic-tag/form/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [session](https://wordpress.org/support/topic-tag/session/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 1 participant
 * Last reply from: [Gaurav Ganeriwala](https://wordpress.org/support/users/gauravganeriwala/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/form-retaining-session-variables/#post-3369571)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
