<?php
	session_start();
	include"../../connect/db.php"; 
 ?>  
<?php
	if( $_POST['user'] ){

		$user = mysqli_real_escape_string($con,$_POST['user']) ;
		$description = mysqli_real_escape_string($con,$_POST['description']) ;
		$d_o_t = mysqli_real_escape_string($con,$_POST['d_o_t']) ;
		$type = mysqli_real_escape_string($con,$_POST['type']) ;
		$status = mysqli_real_escape_string($con,$_POST['status']) ;

        $seed = str_split('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'); // and any other characters
        shuffle($seed); // probably optional since array_is randomized; this may be redundant
        $rand = '';
        foreach (array_rand($seed, 7) as $k) $rand .= $seed[$k];								            
        $transId =  $rand; 

        $query = mysqli_query($con,"INSERT INTO transactions (trans_id, user, description, d_o_t, type, status) VALUES ('$transId', '$user', '$description', '$d_o_t', '$type', '$status') ");

        if( $query ){
            echo"success";
        }   
        else{
            echo "error";
        }


	}
	else{

		echo "error";
	}
?>