<?php
	session_start();
	require 'koneksi.php';
	
	if(isset($_POST['kirim'])){
		$nama = $_POST['name'];
		$hp = $_POST['phone'];
		$email = $_POST['email'];
		$comment = $_POST['comment'];
	}
	if(isset($_SESSION['is_logged_in'])){
		$user = $_SESSION['member_id'];
	}else{
		$user = NULL;
	}
	$query = "INSERT INTO komentar VALUES('', '$user','$nama','$comment', '$email', '$hp')";
	
	$input = mysqli_query($koneksi, $query) or die(mysqli_error($GLOBALS["___mysqli_ston"]));
	if($input){
		header('Location: form_comment.php');
	}else{
		echo'gagal memberikan komentar!';
		header('Location: form_comment.php');
	}
?>