Q:

How can I delete values from input fields after submitting

How exactly is IF EXIST function used in MySQL?
    Alternatively, how can one make sure that the values previously filled into the input fields are cleared completely so that they are not re-posted once the page is reloaded?
This is a slice of my code
<?php
function testInput($data){
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    return $data;
}

if($_SERVER['REQUEST_METHOD']=='POST'){
    $user = testInput($_POST['userName']);
    $fName = testInput($_POST['fName']);
    $lName = testInput($_POST['lName']);
    $fPass = md5(testInput($_POST['fPass']));
    $rPass = md5(testInput($_POST['rPass']));
    $gender = testInput($_POST['gender']);
}               
?>

I want to make sure that the value of my variables='' every time I refresh my page. 

A:

What you are looking for is to prevent repost or backbutton repost
there are many ways to do this

use of session cookie and only allow that session to post once in php
using ajax to post to self or a new page in php so refreshing or backing will prevent repost
iframe the form will also do the trick
Post + Redirect to self

