<?php
session_start();
include_once 'conn.php';
$ndate =date("Y-m-d");
$addnew=$_POST["addnew"];
if ($addnew=="1" )
{
$shangpinbianhao=$_POST["shangpinbianhao"];
$shangpinmingcheng=$_POST["shangpinmingcheng"];
$shangpinleibie=$_POST["shangpinleibie"];
$pinpai=$_POST["pinpai"];
$tupian=$_POST["tupian"];
$jiage=$_POST["jiage"];
$kucunshuliang=$_POST["kucunshuliang"];
$yonghupingjia=$_POST["yonghupingjia"];
$shangpinjieshao=$_POST["shangpinjieshao"];
//lixandonxgjixelxb
//qiuji
//qiuhe
//ischongfu("select id from shangpinxinxi where trjrtjtrjrtj");
$sql="insert into shangpinxinxi(shangpinbianhao,shangpinmingcheng,shangpinleibie,pinpai,tupian,jiage,kucunshuliang,yonghupingjia,shangpinjieshao) values('$shangpinbianhao','$shangpinmingcheng','$shangpinleibie','$pinpai','$tupian','$jiage','$kucunshuliang','$yonghupingjia','$shangpinjieshao') ";
mysql_query($sql);
//danjuzhixi;mysql_query($sql);
echo "<script>javascript:alert('添加成功!');history.back();</script>";
}
?>
<!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=gb2312" />
<title>商品信息</title>
<!--bixanjxiqxi-->
<script type="text/javascript" src="js/My97DatePicker/WdatePicker.js" charset="gb2312"></script>
<link rel="stylesheet" href="css.css" type="text/css">
</head>
<script language="javascript">
function OpenScript(url,width,height)
{
var win = window.open(url,"SelectToSort",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=yes' );
}
function OpenDialog(sURL, iWidth, iHeight)
{
var oDialog = window.open(sURL, "_EditorDialog", "width=" + iWidth.toString() + ",height=" + iHeight.toString() + ",resizable=no,left=0,top=0,scrollbars=no,status=no,titlebar=no,toolbar=no,menubar=no,location=no");
oDialog.focus();
}
</script>
<body>
<p>添加商品信息: 当前日期: <?php echo $ndate; ?></p>
<script language="javascript">
function check()
{
if(document.form1.shangpinmingcheng.value==""){alert("请输入商品名称");document.form1.shangpinmingcheng.focus();return false;}
if((/^(\+|-)?(0|[1-9]\d*)(\.\d*[1-9])?$/.test(document.form1.kucunshuliang.value))){}else{alert("库存数量必需数字型");document.form1.kucunshuliang.focus();return false;}
}
function gow()
{
location.href='shangpinxinxi_add.php?jihuabifffanhao='+document.form1.jihuabifffanhao.value+"&id=<?php echo $_GET["id"]?>";
}
</script>
<!--hxsglxiangdxongjxs-->
<?php
//islbd1q $sql="select * from melieibaoduqubiaoiguo where id=".$_GET["id"];
//islbd2q $sql="select * from melieibaoduqubiaoiguo where hsgzhujian='".$_SESSION["username"]."'";
//islbdq $query=mysql_query($sql);
//islbdq $rowscount=mysql_num_rows($query);
//islbdq if($rowscount>0)
//islbdq {
//islbdq lelelelelele
//islbdq }
?>
<form id="form1" name="form1" method="post" action="?id=<?php echo $_GET["id"]?>">
<table width="100%" border="1" align="center" cellpadding="3" cellspacing="1" bordercolor="#00FFFF" style="border-collapse:collapse">
<tr><td>商品编号:</td><td><input name='shangpinbianhao' type='text' id='shangpinbianhao' value='<?php echo makefilename2()?>' style='border:solid 1px #000000; color:#666666' /></td></tr>
<tr><td>商品名称:</td><td><input name='shangpinmingcheng' type='text' id='shangpinmingcheng' value='' style='border:solid 1px #000000; color:#666666' /> *</td></tr>
<tr><td>商品类别:</td><td><select name='shangpinleibie' id='shangpinleibie'><?php getoption("shangpinleibie","leibie")?></select></td></tr>
<tr><td>品牌:</td><td><input name='pinpai' type='text' id='pinpai' value='' style='border:solid 1px #000000; color:#666666' /></td></tr>
<tr><td>图片:</td><td><input name='tupian' type='text' id='tupian' value='' size='50' style='border:solid 1px #000000; color:#666666' /> <a href="javaScript:OpenScript('upfile.php?Result=tupian',460,180)"><img src="Images/Upload.gif" width="30" height="16" border="0" align="absmiddle" /></a></td></tr>
<tr><td>价格:</td><td><input name='jiage' type='text' id='jiage' value='' style='border:solid 1px #000000; color:#666666' /></td></tr>
<tr><td>库存数量:</td><td><input name='kucunshuliang' type='text' id='kucunshuliang' value='' style='border:solid 1px #000000; color:#666666' /> 必需数字型</td></tr>
<tr><td>用户评价:</td><td><input name='yonghupingjia' type='text' id='yonghupingjia' value='0' style='border:solid 1px #000000; color:#666666' /></td></tr>
<tr><td>商品介绍:</td><td><textarea name='shangpinjieshao' cols='50' rows='8' id='shangpinjieshao' style='border:solid 1px #000000; color:#666666'></textarea></td></tr>
<tr>
<td> </td>
<td><input type="hidden" name="addnew" value="1" />
<input type="submit" name="Submit" value="添加" onclick="return check();" style='border:solid 1px #000000; color:#666666' />
<input type="reset" name="Submit2" value="重置" style='border:solid 1px #000000; color:#666666' /></td>
</tr>
</table>
</form>
<p> </p>
<?php
function ischongfu($sql)
{
$query=mysql_query($sql);
$rowscount=mysql_num_rows($query);
if($rowscount>0)
{
echo "<script>javascript:alert('对不起,您输入的tsisshistxiaojxi已经存在,请重试!');history.back();</script>";
exit;
}
}
?>
</body>
</html>