Viewing file: addSeller.php (6.44 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
session_start();
/** Define Validate Access */
define( '_VALID_ACCESS', 1 );
/** Check Session User Login */
if (! session_is_registered("valid_user") ) {
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-874\" />";
echo "<p style=padding-top:115px><p align=center><br /><font color=red><strong>กรุณาทำการ Login ก่อน</strong></font></p></p>";
echo "<meta http-equiv=\"refresh\" content=\"1; URL=../login.php\" />";
exit();
}
else {
/** Configuration */
require_once( "../configuration.php" );
require_once( $_Config_absolute_path . "/includes/framework.php" );
require_once("../includes/FunctionDB.php");
/** Create Database Object */
$dbObj = new DBConn;
$msg = " ";
$reload = "";
if ( !empty($sell_name ) )
{
$sell_name = ereg_replace ("\"",""" ,"$sell_name");
$query = "SELECT * FROM accessories_sell WHERE sell_id ='$sell_id' ";
$result1 = $dbObj->execQuery($query);
$rs = $dbObj->fetchArray($result1);
$num_rows = mysql_num_rows($result1);
if($num_rows){
$query1 = " UPDATE accessories_sell SET sell_name ='$sell_name' , sell_address ='$sell_address' , sell_tel ='$sell_tel' ,sell_fax='$sell_fax' ,sell_Sales='$sell_Sales' ,sell_mobile='$sell_mobile' WHERE sell_id='$sell_id' ";
$result1 = $dbObj->runQuery($query1);
$dbObj->freeresult($result1);
}
else{
InsertSell ($sell_name, $sell_address , $sell_tel , $sell_fax , $sell_Sales ,$sell_mobile ) ;
}
$msg = "<font color=\"#FF0000\"><strong> เพิ่มข้อมูลผู้ขายหรือบริจาค '<font color=\#0000FF\"> $sell_name </font>' COMPLETE</Strong></font> ";
$reload = "<script language=\"JavaScript\">\n";
$reload = $reload."parent.frames.nav.location.reload();\n";
$reload = $reload."</script>";
echo "<script>window.opener.document.all.form1; window.opener.location.reload(); window.close();</script>";
//echo "<meta http-equiv=\"refresh\"content=\"2;URL=AddSource.php\">\n";
}
else {
$msg = "<font color=\"#FF0000\"><strong>ยังไม่ได้กรอกข้อมูลประเภทห้อง </Strong></font> ";
}
$query = " SELECT * FROM accessories_sell WHERE sell_id='$sell_id' ";
$result = $dbObj->execQuery($query);
$rs = $dbObj->fetchArray($result);
} #else
?>
<!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=windows-874" />
<link href="../css/default.css" rel="stylesheet" type="text/css" />
<title><?=$_Config_sitename;?></title>
</script>
<script language ="javascript">
function check()
{
if(document.form1.sell_name.value == "")
{
alert('กรุณากรอกชื่อผู้ขาย / บริจาค');
document.form1.sell_name.focus();
return false;
}
if(document.form1.sell_address.value == "")
{
alert('กรุณากรอกที่อยู่ผู้ขาย / บริจาค');
document.form1.sell_address.focus();
return false;
}
if(isNaN(document.form1.sell_tel.value))
{
alert("กรุณากรอกเบอร์โทรศัพท์เป็นตัวเลขเท่านั้น!!");
// document.form1.Phone.focus();
return false;
}
else
{
document.form1.submit();
}
}
</script>
<table width="534" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="534" height="194">
<form id="form1" name="form1" method="post" action="<? echo $PHP_SELF; ?>">
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="0" style="background-color:#eeeeee; border:0px solid gray; font-size: 14px;"size="12">
<tr bgcolor="#F3F3F3">
<td height="28" colspan="2" align="center" bordercolor="#CCCCCC" bgcolor="#FFFFFF" valign="middle"><h3><b>บันทึกข้อมูลผู้ขาย / บริจาค</b></h3></td>
</tr>
<tr bgcolor="#F3F3F3">
<td width="24%" height="22" align="right" bgcolor="#FFFFFF" class="style2">ชื่อผู้ขาย / บริจาค : </td>
<td width="76%" bordercolor="#FFFFCC" bgcolor="#FFFFFF"><input name="sell_name" type="text" size="50" value="<?=$rs['sell_name'];?>" id="sell_name" />
*</td>
</tr>
<tr bgcolor="#F3F3F3">
<td align="right" height="22" bgcolor="#FFFFFF" class="style2">ที่อยู่ผู้ขาย / บริจาค : </td>
<td width="76%" bordercolor="#FFFFCC" bgcolor="#FFFFFF"><input name="sell_address" type="text" id="sell_address" value="<?=$rs['sell_address'];?>" size="60" />
*</td>
</tr>
<tr bgcolor="#F3F3F3">
<td align="right" height="23" bgcolor="#FFFFFF" class="style2">เบอร์โทรศัพท์ : </td>
<td width="76%" bordercolor="#FFFFCC" bgcolor="#FFFFFF"><input name="sell_tel" type="text" size="10" value="<?=$rs['sell_tel'];?>" id="sell_tel" />
(ไม่ต้องมี -)</td>
</tr>
<tr bgcolor="#F3F3F3">
<td height="24" align="right" bordercolor="#CCCCCC" bgcolor="#FFFFFF">เบอร์แฟ็กซ์ :</td>
<td bordercolor="#FFFFCC" bgcolor="#FFFFFF"><input name="sell_fax" type="text" size="10" value="<?=$rs['sell_fax'];?>" id="sell_fax" /></td>
</tr>
<tr bgcolor="#F3F3F3">
<td height="24" align="right" bordercolor="#CCCCCC" bgcolor="#FFFFFF">ชื่อผู้ติดต่อ :</td>
<td bordercolor="#FFFFCC" bgcolor="#FFFFFF"><input name="sell_Sales" type="text" size="25" value="<?=$rs['sell_Sales'];?>" id="sell_Sales" />
มือถือ
<input name="sell_mobile" type="text" size="10" value="<?=$rs['sell_mobile'];?>" id="sell_mobile" /></td>
</tr>
<tr bgcolor="#F3D6F2">
<td height="26" colspan="2" align="center" bgcolor="#FFFFFF"><input name="Submit" type="submit" class="WIDTH60" id="Submit" value="บันทึก" onclick="return(check())" />
<input name="Reset" type="reset" class="WIDTH60" id="Reset" value="Reset" />
<input type="button" name="Submit" value="ปิดหน้าต่าง" onclick="javascript:parent.close();" class="CURSOR-HAND" id="Submit" />
<input name="sell_id" type="hidden" id="sell_id" value="<?=$rs['sell_id'];?>" /></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
|