<?php 

class User {
	
	function __construct(){
	$host_name="localhost";
	$user_name="kidazzl1_pay";
	$password="VjWVfkJCAMQn";
	$db_name="kidazzl1_paywindow";

	$connection=mysqli_connect($host_name,$user_name,$password);
	if ($connection) {
		//echo "Server connected!!";
	}

	else{
		die("Query Problem".mysqli_error($connection));
	}

	$select_db=mysqli_select_db($connection,$db_name);
	if ($select_db) {
		//echo "DB selected";
		return $connection;
	}

	else{
		die("Query Problem".mysqli_error($connection,$select_db));
	}

		
	}


public function save_user_info($data){
	$connection=$this->__construct();
	$user_name= $data['user_name'];
	$user_email=$data['user_email'];
	$user_number=$data['user_number'];

	if ($user_name== "" OR $user_email== "" OR $user_number=="") {
		$message="<div class='alert alert-danger my-2'>Error !! Input field must be required??</div>";
		return $message;
	}

	$query="INSERT INTO user_tbl(user_name,user_email,user_number) VALUES ('$user_name','$user_email','$user_number')";
	if(mysqli_query($connection,$query)){
	$message2="<div class='alert alert-success my-2'>Your information has been sent !!</div>";
	return $message2;
		
}

}
}
?>