<?php 
require_once 'config.php';
$error=false;
$errors=array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
   
   $desginer=mysqli_fetch_array(mysqli_query($con,"SELECT * FROM users WHERE id=".$_POST['user_id']));
   //echo '<pre>';print_r($desginer);die;
   $first_name=$desginer['first_name'];
   $last_name=$desginer['last_name'];
   $merchant_name=$first_name.' '.$last_name;
	$name=$_POST['offer_name'];
	$price=$_POST['price'];
	$description=$_POST['description'];
		$createEmployee=mysqli_query($con,"INSERT INTO offers (merchant_id,merchant_name,title,price,description,status) VALUES('".$_POST['user_id']."','".$merchant_name."','".$name."','".$price."','".$description."',1)");
	 if($createEmployee){
	     	$errors['success']='Offer created Sucessfully';
	 }else{
	     $errors['success']='Somthing went wrong !!';
	 }
 	 
	 	echo json_encode($errors);
}