<?php
include('../headertop.php');
include('../db.php');
//include('../datepicker.php');

$disp = '';
$pagetitle = 'Add New Investment';

date_default_timezone_set('Asia/Kolkata');

if(!isset($_POST['addinvestmentsubmit']))
{
echo '<meta http-equiv="refresh" content="0;URL=addinvestment.php">';
exit;
}

$date = $_POST['date'];
$amount = $_POST['amount'];
$particulars = $_POST['particulars'];
$investor = $_POST['investor'];
$payment_method=$_POST['payment_method'];
$payment_details = $_POST['payment_details'];


if(empty($investor) or empty($date) or empty($amount) or empty($particulars) or empty($payment_method))
{
$disp .= '<span class="errordiv">Please go back and fill all required fields</span>';
include('../template.php');
exit;
}

$datedb = $date;
//$datedb = date("Y-m-d", strtotime($date));
//$dateref = date("dmY", strtotime($date));


/*
if(!is_numeric($no_floors))
{
$disp .= '<span class="errordiv">Number of floors should be numeric value</span>';
include('../template.php');
exit;
}
*/
$q = "insert into investments (investor,date, amount, particulars,  payment_method, payment_details) values('$investor','$date','$amount','$particulars','$payment_method', '$payment_details')";
mysqli_query($dbcon,$q) or die(mysqli_error($dbcon));
$eid = mysqli_insert_id($dbcon);

$sm = "Investment information saved ";
echo '<meta http-equiv="refresh" content="0;URL=addinvestment.php?sm='.$sm.'">';

