<?php

session_start();
// $cemail = $_SESSION['email'];
//$agent_id = $_SESSION['agent_id'];


include "conn.php";

if ($_POST['designation'] && $_POST['name'] && $_POST['mobile'] && $_POST['state_id'] && $_POST['district_id'] && $_POST['password']) 
{
    $designation =$_POST['designation'];
	$name = $_POST['name'];
	$email = $_POST['email'];
	$mobile = $_POST['mobile'];
	$state_id = $_POST['state_id'];
	$district_id = $_POST['district_id'];
	$address = $_POST['address'];
	$password = $_POST['password'];
	$vendor_code ="MHA".$mobile;
	$query = "INSERT INTO `tbl_vendor` (
	`designation`,
	`name`,
	`mobile`,
	`email`,
	`state_id`,
	`district_id`,
	`address`,
	`password`,
	`v_code`) 
	VALUES ('$designation','$name','$mobile','$email','$state_id','$district_id','$address','$password','$vendor_code')";  

	$smt = mysqli_query($conn, $query);
	if ($smt) {
		echo "Dear ".$name.",\nYour account created successfully,\nYour User ID :". $vendor_code."\nPassword:".$password."\nPlease call to MHA for account activation and login.\nThank You\nTeam MHA";
	} else {
		echo ("Failed ! Error Description: " . mysqli_error($conn));
	}
} else {
	echo ("Please Enter all * Marked Fields. " . mysqli_error($conn));
}

?>