$title = 'New Comment';
$ncomment = new HTML_QuickForm('ncomment', 'post', '/?admin&cmd=ncomment&pid='.$_GET['pid']);
$ncomment->addElement('hidden', 'pid', '', $_GET['pid']);
$ncomment->applyFilter('pid', 'trim');
$ncomment->addRule('pid', 'PID NOT SET', 'required');
$ncomment->addElement('text', 'title', 'Title');
$ncomment->applyFilter('title', 'trim');
$ncomment->addRule('title', 'Please enter a title.', 'required');
$ncomment->addElement('textarea', 'comment', 'Comment', array('rows' => 10, 'cols' => 40));
$ncomment->applyFilter('comment', 'trim');
$ncomment->addRule('comment', 'Please put in a comment.', 'required');
$ncomment->addElement('submit', 'submit', 'Submit');
echo ($ncomment->validate());
if($ncomment->validate()){
$ncomment->freeze();
echo 'frozen';
$ncomment->process('newcomment', false);
}else{
$ncomment->display();
}
function newcomment($input){
global $posts;
global $user;
$posts->new_comment($input['title'], $input['comment'], $input['pid'], $input['uid'], $user['username']);
print_r($input);
}