I have a comment form and I'm having trouble to empty my post after submitting, well here's my form:
<?php
if(isset($_POST['comment']))
{
$fields = array(
"module" => db_decode($node_delta['tid']) ,
"delta" => db_decode($node_delta['nid']) ,
"title" => db_decode($_POST['subject']) ,
"author" => db_decode($_POST['username']) ,
"content" => db_decode($_POST['comment']) ,
"status" => db_decode('pending') ,
"date_comment" => new Zend_Db_Expr('NOW()') ,
) ;
db_insert("comment", $fields) ;
unset($_POST);
}
?>
<form class="form-horizontal" method="post" id="comment" action="" role="form">
<input type="hidden" id="comment-element-0" value="comment" name="form">
<input type="hidden" id="comment-element-1" value="insert" name="action">
<div class="form-group"><label for="comment-element-2" class="control-label col-md-3">
<span class="required">* </span>Username</label>
<div class="col-md-6">
<input type="text" id="comment-element-2" required="" value="" name="username" class="form-control input-md">
</div>
</div>
<div class="form-group"><label for="comment-element-4" class="control-label col-md-3">
<span class="required">* </span>Subjet</label>
<div class="col-md-6">
<input type="text" id="comment-element-4" required="" value="" name="subject" class="form-control input-md">
</div>
</div>
<div class="form-group"><label for="comment-element-5" class="control-label col-md-3">
<span class="required">* </span>Comment</label>
<div class="col-md-6">
<textarea class="form-control input-md" id="comment-element-5" required="" name="comment" rows="5"></textarea>
</div>
</div>
<div class="form-group">
<div class="form-actions col-md-9 col-md-offset-3 text-right">
<input type="submit" id="comment-element-6" class="btn btn-primary" name="" value="Submit">
</div>
</div>
</form>
The issue here is if I refresh the value of post still have the same content, why does unset($_POST);
doesn't do the trick? Any help with this ? Much appreciated!