I'm using form like this to add records to database:
<form class="col s12" action="" method="post">
                <div class="row">
                    <div class="input-field col s6">
                        <input placeholder="" name="n" id="n" type="text" class="validate">
                        <label for="n">Name</label>
                    </div>
                    <div class="input-field col s4">
                        <input placeholder="" name="price" id="price" type="text" class="validate">
                        <label for="price">Price</label>
                    </div>
                    <div class="input-field col s2">
                        <input placeholder="" name="catid" id="catid" type="number" class="validate">
                        <label for="catid">Category</label>
                    </div>
                </div>
                <div class="row">
                    <div class="input-field col s12">
                        <input placeholder="" name="desc" id="desc" type="text" class="validate">
                        <label for="desc">Description</label>
                    </div>
                </div>
        </div>
        <div class="modal-footer">
            <button class="btn waves-effect waves-light" type="submit" name="create" style="float:left; margin: 5px;" onClick="clearform();">
                <i class="material-icons left">add</i>Create
            </button>
            <a href="#!" class="modal-action modal-close waves-effect waves-light btn" style="float:left; margin: 5px"><i class="material-icons left">clear</i>Close</a>
        </div>
        </form>
here is the function to add records:
public function create($n, $desc, $price, $catid) {
    $this->conn->prepare("INSERT INTO `products` (`ID`, `Name`, `Description`, `Price`, `CategoryID`, `Created`, `Modified`) VALUES (NULL, '$n', '$desc', '$price', '$catid', NOW(), NOW())")->execute();
    $this->name = $n;
    $this->description = $desc;
    $this->price = $price;
    $this->catid = $catid;
}
if($_SERVER['REQUEST_METHOD'] == 'POST'){
if ( isset( $_POST['create'], $_POST['n'], $_POST['desc'], $_POST['price'], $_POST['catid']) ) {
    $cat = new Product($conn);
    $n = filter_input ( INPUT_POST , 'n', FILTER_SANITIZE_STRING );
    $desc = filter_input ( INPUT_POST , 'desc', FILTER_SANITIZE_STRING );
    $price = filter_input ( INPUT_POST , 'price', FILTER_SANITIZE_STRING );
    $catid = filter_input ( INPUT_POST , 'catid', FILTER_SANITIZE_NUMBER_INT );
    $cat->create($n, $desc, $price, $catid);
}
}
Records are added to the db, but the problem is, that every time I refresh the page, they are added again. How to solve that?
 
     
    