<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
	$first_name				= $_POST['firstname'];
	$last_name				= $_POST['lastname'];
	$faculte				= $_POST['faculte'];
	$ann				      = $_POST['anneeAc'];
	$conf				      = $_POST['confirme'];
	$confp				      = $_POST['confpromotion'];
	$conffac				      = $_POST['conffaculte'];
	$conft				      = $_POST['conftous'];
	$confsect				      = $_POST['confsecteur'];
    $fonction			    = $_POST['fonction'];
	$pay				      = $_POST['pays'];
    $sect			         = $_POST['secteur'];
	$autr			         = $_POST['autres'];
	$phone			        = $_POST['telephone'];
	$email					= $_POST['username'];
	$com					= $_POST['comment'];
	$password				= $_POST['password'];
	$confirm_password		=  $_POST['confirm_password'];

	

		$sql = "SELECT username, password FROM member WHERE username = '$email' AND password = '$password'";
	$count = $conn->query($sql);
	
	if ($count > 0){ ?>
<script>
alert('Data Already Exist');
</script>
<?php
}else{
		$sql = "INSERT INTO member (cat_id, firstname, lastname, faculte,anneeAc, fonction,confirme, pays,secteur,autres, telephone ,username,comment, password,confpromotion,conffaculte,conftous,confsecteur, date_added)
		VALUES ('3','$first_name', '$last_name', '$faculte','$ann', '$fonction','$conf','$pay','$sect','$autr', '$phone' ,'$email','$com', '$password','$confp','$conffac','$conft','$confsect', now())";

		
			}
			
			
			
		

}
?>