<?php
if(!defined('IN_TM')) {exit('Access Denied');}

	if(empty($_REQUEST['Submit'])){
		$tplid = 2;
		$db->close();
		include template('order.htm');
	}else{
		$title = getgpc('title');
		$sl = getgpc('sl');
		$name = getgpc('name');
		$tel = getgpc('tel');
		$mail = getgpc('mail');
		$body = getgpc('bz');
		if(empty($title)){
			die("<script>alert('请填写产品名称!重要！'); history.go(-1);</script>");
		}elseif(empty($name)){
			die("<script>alert('请输入您称呼！'); history.go(-1);</script>");
		}elseif(empty($tel)){
			die("<script>alert('请输入联系电话！'); history.go(-1);</script>");
		}
		$sql = "INSERT INTO `{$tablepre}order` (`title` ,`num` ,`name` ,`tel` ,`email` ,`body` ,`time`)VALUES ('$title', '$sl', '$name', '$tel', '$mail','$body', '$timestamp');";
		$rs = $db->query($sql);
		if($rs){
			die("<script>alert('恭喜，您的订单已经提交到业务部，敬请等待业务人员联系您，谢谢！');history.go(-1);</script>");
		}else{
			die("<script>alert('服务器繁忙请稍后再试！'); history.go(-1);</script>");
		}
	}
?>