<?php
	session_start();
	include"../../connect/db.php";

	if( isset($_POST['name']) ){

		$name = mysqli_real_escape_string($con,$_POST['name']);
		$position = isset($_POST['position']) ? mysqli_real_escape_string($con,$_POST['position']) : '';
		$testimony = isset($_POST['testimony']) ? mysqli_real_escape_string($con,$_POST['testimony']) : '';
		$image = isset($_POST['image']) ? mysqli_real_escape_string($con,$_POST['image']) : '';
		$date = date('Y-m-d H:i:s');

		$sql = mysqli_query($con,"INSERT INTO testimonies (name, position, testimony, image, date) VALUES ('$name', '$position', '$testimony', '$image', '$date')");

		if( $sql ){
			echo "success";
		}
		else{
			echo "error";
		}

	}
	else{
		echo "error";
	}
?>