<?php 
include ('database.php');
session_start();

$id= $_SESSION['id'];
if(isset($_POST['submit']));
{
    $name = mysqli_real_escape_string($connection, $_POST['name']);
    $card = mysqli_real_escape_string($connection, $_POST['card']);
    $address = mysqli_real_escape_string($connection, $_POST['address']);
	  $cvc = rand(100,999);
	$number = rand(1000,9999);
    $expire = date('m');
	 //register users data
	 $query = "INSERT INTO card (`id`, `card`, `name`, `number`, `cvc`, `expire`, `address`) VALUES ('$id', '$card', '$name', '$number', '$cvc', '$expire', '$address')";
     $query_run = mysqli_query($connection, $query);

 if($query_run)
 {
    	 
	 header("location:../pending.php"); 
 }
 else
 {
    $_SESSION['status'] = "<h5 style='padding:8px; background: #fe8b8e; border-radius: 10px; color: #fff; text-align: center;'>Can not process at this moment</h5>";
    header("location: ../requestcard.php");
 }
}
?>