<?php session_start();?>
<?php include'includes/db.php';?>
<?php

$phoneNo = $_POST['mobile'];


// validate customer
$val = "SELECT 	* FROM account WHERE mobile = ?";
$valPdo = $pdo->prepare($val);
$valPdo->execute([$phoneNo]);

if ($valPdo->rowCount() > 0) {
	$row = $valPdo->fetch(PDO::FETCH_ASSOC);
	$firstname = $row['firstname'];
	$lastname = $row['lastname'];

	$_SESSION['customer'] = $phoneNo;
	$_SESSION['lastname'] = $lastname;
	$_SESSION['phoneNo'] = $phoneNo;
	echo "redirect";
}else{
	$_SESSION['phoneNo'] = $phoneNo;
	require'add-customer.php';

}


?>
