<?php 
function sm_add_new_account_details(){
    $holder=$_POST['holder'];
	$status=$_POST['status'];
	$iban=$_POST['iban'];
	$bic=$_POST['bic'];
	$bank_code=$_POST['bcode'];
	$bank_name=$_POST['bname'];
	$bank_address=$_POST['baddress'];
	$assign_to=$_POST['assign_to'];
    $cretedDate= date( 'd-m-Y');

    global $table_prefix,$wpdb;
	$accountTable=$table_prefix . 'sm_accounts_management';

  	// add form data to custom database table
	$account_created = $wpdb->insert(
	    $accountTable,
	    array(      
 	      'AccountHolder'   => 	$holder,
		  'Status'       	=> 	$status,
		  'IBAN'       		=> 	$iban,
		  'BIC'             => 	$bic,
		  'BankCode'        => 	$bank_code,
		  'BankName' 		=> 	$bank_name,
		  'BankAddress'     => 	$bank_address,
		  'AssignedTo'      =>  $assign_to,
		  'Date'            => 	$cretedDate
	    )
	);
	if($account_created){
		echo "Account Details added Successfully.";
		$redirect_url = get_permalink( get_page_by_title( 'SM View Accounts' ) );
		header( "refresh:4; url='$redirect_url");
	}
	else{
		echo "Something Wrong";
	}
    
}
?>