<?php  include("../../include/dbconnect.php");?>
<?php 
//echo "fsdfsdfs" . "$prodcode" . "    " ;
//echo "$bcode";

if($confirm=="Yes")
{
	if(empty($bcode)) 
	{
		echo("Customer not selected, Please select Customer and resubmit<br>");
		exit;
	}

	if($prodcode=='0')
	{
		echo("Product not selected, Please select Product and resubmit<br>");
		exit;
	}

	if(empty($enquiryref_no))
	{
		echo("No Enquiry Reference number ,Please Type Enquiry No and resubmit<br>");
		exit;
	}

	if(empty($sdt))
	{
		echo("Eqnuiry Date is not entered, please enter the Enquiry Date and resubmit<br>");
		exit;
	}	

	$sdate = $sdt;
	$enq_dt = substr($sdate,6,4).'-'.substr($sdate,3,2).'-'.substr($sdate,0,2);
	
	
	$result = mysql_query("select drawing_no from product where prodcode ='$prodcode' and bcode ='$bcode' ") or die(mysql_error());
	$row = mysql_fetch_row($result);
	$drawing_no = $row[0];

	$query="insert into enquiry values('$bcode', '$prodcode', '$drawing_no', '$enquiryref_no', '$enq_dt', '$qty', '$sample', '$tools', '$feasible', '$enquiry_open', '', '', '', '', '', '', '', '', '', '', '', '', '', '', NULL)";
//echo "$query";	
	mysql_query($query) or die (mysql_error());
		
}	

?>
<meta http-equiv="refresh" content="0 url=index.html">
</body></form>



