<div dir="rtl">
	<?php
	include("header.php");

	if (
		isset($_POST['cod_meli']) && !empty($_POST['cod_meli']) &&
		isset($_POST['name']) && !empty($_POST['name']) &&
		isset($_POST['mbl_cod']) && !empty($_POST['mbl_cod']) &&
		isset($_POST['mbl_name']) && !empty($_POST['mbl_name']) &&
		isset($_POST['mbl_select_canteri']) && !empty($_POST['mbl_select_canteri']) &&
		isset($_POST['mbl_select_nafar']) && !empty($_POST['mbl_select_nafar']) &&
		isset($_POST['mbl_action_nafar']) && !empty($_POST['mbl_action_nafar']) &&
		isset($_POST['mbl_select_rang']) && !empty($_POST['mbl_select_rang']) &&
		isset($_POST['jens']) && !empty($_POST['jens']) &&
		isset($_POST['mbl_select_years']) && !empty($_POST['mbl_select_years']) &&
		isset($_POST['tel']) && !empty($_POST['tel']) &&
		isset($_POST['email']) && !empty($_POST['email']) &&
		isset($_POST['addres']) && !empty($_POST['addres']) &&
		isset($_POST['mbl_price']) && !empty($_POST['mbl_price'])
	) {




		$cod_meli = $_POST['cod_meli'];
		$name = $_POST['name'];
		$mbl_cod = $_POST['mbl_cod'];
		$mbl_name = $_POST['mbl_name'];
		$mbl_select_cantre = $_POST['mbl_select_canteri'];
		$mbl_select_nafar = $_POST['mbl_select_nafar'];
		$mbl_action_nafar = $_POST['mbl_action_nafar'];
		$mbl_select_rang = $_POST['mbl_select_rang'];
		$jens = $_POST['jens'];
		$mbl_select_years = $_POST['mbl_select_years'];
		$tel = $_POST['tel'];
		$email = $_POST['email'];

		$addres = $_POST['addres'];
		$mbl_price = $_POST['mbl_price'];
	} else
		exit("مشخصات کامل نیست.");




	$link = mysqli_connect("localhost", "root", "", "shop");
	if (mysqli_connect_errno()) {
		exit("چنین خطایی رخ داده است" . mysqli_connect_error());
	}












	$query = "INSERT INTO factor
(cod_meli, name, tel, mbl_cod, mbl_name, mbl_select_cantre, mbl_select_nafar, mbl_action_nafar,
mbl_select_rang, jens, data, mbl_price, mbl_select_years,
email ,addres, state, action_state) VALUES ('$cod_meli','$name',
'$tel','$mbl_cod','$mbl_name','$mbl_select_cantre','$mbl_select_nafar','$mbl_action_nafar',
'$mbl_select_rang','$jens',
'" . date('F j, Y,g:i a') . "','$mbl_price','$mbl_select_years','$email','$addres','0',
'در حال بررسی')";



	if (mysqli_query($link, $query) === true) {
		echo ("<p style='color:green;'><b>کالا با موفقیت ثبت شد<b/></p>");
	} else
		echo ("<p style='color:red;'><b>خطا در ثبت فاکتور<b/></p>");





	mysqli_close($link);





	?>

</div>