<?php
include("CheckSession.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="馬戲團" />
<title>馬戲團</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<script language="javascript">
function SendInsert()
{
  if(form.QueryTel.value.length == 0)
	{
		alert("請輸入手機號碼!");
		form.QueryTel.focus();		
		return false;                              
	}
	location.href = "CustomerInput1.php?QueryTel=" + document.all["QueryTel"].value + "&AId=" + document.all["AId"].value + "&AName=" + document.all["AName"].value;
}
</script>
<?php

require_once("class/DBConfig.php");
require_once("class/DBOperation.php");

$AId = $_POST["AId"];
$AddTel = $_POST["AddTel"];
if($AddTel == null)
{
	$AddTel = "";
}

$db = new DBOperation();
$db->connect_db($_DB['host'], $_DB['username'], $_DB['password'], $_DB['dbname']);
$querySql = "select * from AdminUser where AId = ".$AId." and AFlag = '1'";

$db->query($querySql);
$myrow = $db->fetch_array();
$db->close_db();
if($myrow == null)
{
	echo '<script type="text/javascript">';
  echo 'alert("無此使用者!!!");';
  echo 'location.href="CustomerIndex1.php"';
  echo '</script>';
  exit(0);
}

?>
<body>
<form name="form" method="post" action="CustomerInput.php?actionOp=Insert">
<table border="0" cellspacing="1" cellspadding="1" width="95%">
<input type="hidden" value="<?php echo $AId; ?>" name="AId" id="AId" />
<input type="hidden" value="<?php echo $myrow['AName']; ?>" name="AName" id="AName" />
<tr>
<td align="center" colspan="2" width="70%">
&nbsp;
</td>
</tr>
<tr>
<td align="center" colspan="2" width="70%">
<table width="100%" border="1" cellspacing="2" cellpadding="2">
<tr>
<td align="center" width="20%">
<span class="t12">誰的客戶</span>
</td>
<td align="left">
<span class="t12"><?php echo $myrow['AName'];?></span>
</td>
</tr>
<tr>
<td align="center" width="20%">
<span class="t12">電話</span>
</td>
<td align="left">
<input type="text" value="<?php echo $AddTel;?>" name="QueryTel" id="QueryTel" size="70" maxlength="255" style="font-size: 12.0pt;font-family: 微軟正黑體;"/>
</td>
</tr>
<tr>
<td align="center">
<input type="button" name="btnView" id="btnSub" value="返回" class="t12" onclick="javascript:location.href='CustomerIndex1.php';" style="WIDTH:150px;Height:40px;"/>
</td>
<td align="center">
<input type="button" name="btnSub" id="btnSub" value="繼續新增" class="t12" style="WIDTH:550px;Height:40px;" onclick="javascript:return SendInsert();"/>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>