一般常用源码

带有批量删除   点击帅选   搜索  删除等功能

<?php

    require 'includes/common.inc.php';
    session_start();
    if ( !isset($_SESSION['adminName']) ) {
        _location('请先登录!','login.php');
    }
    define('SCRIPT','order');

global $_pagesize,$_pagenum;
    
    if ( !isset($_GET['state']) ) {
        _page('SELECT id FROM tb_order',10);
        $_sql = "SELECT * FROM tb_order LIMIT $_pagenum,$_pagesize";
    } elseif ( $_GET['state'] == 0 ) {
        _page('SELECT id FROM tb_order WHERE state = 0',10);
        $_sql = "SELECT * FROM tb_order WHERE state = 0 LIMIT $_pagenum,$_pagesize";
    } elseif ( $_GET['state'] == 1  ) {
        _page('SELECT id FROM tb_order WHERE state = 1',10);
        $_sql = "SELECT * FROM tb_order WHERE state = 1 LIMIT $_pagenum,$_pagesize";
    } elseif ( $_GET['state'] == 2  ) {
        _page('SELECT id FROM tb_order WHERE state = 2',10);
        $_sql = "SELECT * FROM tb_order WHERE state = 2 LIMIT $_pagenum,$_pagesize";
    } elseif ( $_GET['state'] == 3  ) {
        _page('SELECT id FROM tb_order WHERE state = 3',10);
        $_sql = "SELECT * FROM tb_order WHERE state = 3 LIMIT $_pagenum,$_pagesize";
    } elseif ( $_GET['state'] == 4  ) {
        _page('SELECT id FROM tb_order WHERE state = 4',10);
        $_sql = "SELECT * FROM tb_order WHERE state = 4 LIMIT $_pagenum,$_pagesize";
    } elseif ( $_GET['state'] == 5  ) {
        _page('SELECT id FROM tb_order WHERE state = 5',10);
        $_sql = "SELECT * FROM tb_order WHERE state = 5 LIMIT $_pagenum,$_pagesize";
    } elseif ( $_GET['state'] == 6  ) {
        _page('SELECT id FROM tb_order WHERE state = 6',10);
        $_sql = "SELECT * FROM tb_order WHERE state = 6 LIMIT $_pagenum,$_pagesize";
    }
    $_result = _query($_sql);
    if ( isset($_GET['id']) && $_GET['action'] = 'delete' ) {
        $_sql1 = "DELETE FROM tb_order WHERE id = '{$_GET['id']}'";
        _query($_sql1);

        if ( _affected_rows() == 1 ) {
            _close();
            _alert_back('删除成功!');
        } else {
            _close();
            _alert_back('删除失败!');
        }
    }
    
    if ( @$_GET['action'] == 'deleteAll' && isset($_POST['ids']) ) {
        $_clean['ids'] = _mysql_string(implode(',',$_POST['ids']));
    
        $_sql2 = "DELETE FROM tb_order WHERE id IN ({$_clean['ids']})";
        _query($_sql2);
    
        if( _affected_rows() ){
            _close();
            _alert_back('删除成功!');
        }else{
            _close();
            _alert_back('删除失败!');
        }
    }
    
        if ( @$_GET['action'] == 'search' ) {
            $_clean = array();
            $_clean['stype'] = _check($_POST['stype']);
            $_clean['key'] = _check($_POST['key']);
            
            if  ( $_clean['stype'] == 'userid' ) {
                _page("SELECT id FROM tb_order WHERE orderNumber = '{$_clean['key']}'",10);
                $_sql = "SELECT id,orderNumber,addDates,userid,theGoodsName,theGoodsPhone ,distribution,AmountPayable,payment,payMoney,payIntegral,returnIntegral,state FROM tb_order WHERE userid = '{$_clean['key']}' LIMIT $_pagenum,$_pagesize";
            } elseif ( $_clean['stype'] == 'userid' ) {
                _page("SELECT id FROM tb_order WHERE userid = '{$_clean['key']}'",10);
                $_sql = "SELECT id,orderNumber,addDates,userid,theGoodsName,theGoodsPhone ,distribution,AmountPayable,payment,payMoney,payIntegral,returnIntegral,state FROM tb_order WHERE userid = '{$_clean['key']}' LIMIT $_pagenum,$_pagesize";
            }
        }    
    $_result = _query($_sql);    
    ?>
<!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" />
<title>后台管理--订单管理</title>
<style type="text/css">
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    background-color: #F8F9FA;
}
-->
</style>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript">
window.onload = function(){
    
    var form = document.getElementById('deleteAll')[0];
    
    form.onsubmit = function(){
        
        if(window.confirm("确定删除这批短信吗?")){
            
            return true;
            
        }
        
        return false;
    
    }
    
};
</script>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
    <td  valign="top" background="images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
        <tr>
          <td height="31"><div class="titlebt">订单管理</div></td>
        </tr>
      </table></td>
    <td width="17" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
  </tr>
  <tr>
    <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9"><div>
        <!---->
        <table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" >
          <tr>
            <td></td>
          </tr>
        </table>
        <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td height="20"><div style="font-size:12px;line-height:25px;">查看:<a href='order.php'>全部</a> <a href="?state=0">待付款</a> <a href="?state=1">待发货</a> <a href="?state=2">已发货</a>&nbsp;<a href="?state=3">已完成</a> <a href="?state=3">待付款客户作废</a> <a href="?state=3">待付款员工作废</a> <a href="?state=3">已完成删除</a>
                <div style="border-right:50" align="center">
                <form action="?action=search" method="post"  οnsubmit="return test();">
                    关键字:
                    <select name="stype" id="stype">
                          <option value="orderNumber">订单号</option>
                         <option value="userid">会员ID</option>
                    </select>
                    <input name="key" type="text" id="key" />
                    <input name="" type="submit" value="搜索" />
                  </form>
                </div>
              </div>            </td>
          </tr>
          <tr>
            <td><form action="?action=deleteAll" id='deleteAll' method="post" >
                <table width="100%" height="83" border="0" cellpadding="0" cellspacing="0" class="nowtable">
                  <tr align="center">
                    <Td width="4%" height="27" bgcolor="#F2F2F2" class="left_txt2"></Td>
                    <td width="10%" bgcolor="#F2F2F2" class="left_txt2">订单号</td>
                    <td width="10%" bgcolor="#F2F2F2" class="left_txt2">时间</td>
                    <td width="6%" bgcolor="#F2F2F2" class="left_txt2">用户ID</td>
                    <td width="7%" bgcolor="#F2F2F2" class="left_txt2">姓名</td>
                    <td width="11%" bgcolor="#F2F2F2" class="left_txt2">联系电话</td>
                    <td width="8%" bgcolor="#F2F2F2" class="left_txt2">配送方式</td>
                    <td width="6%" bgcolor="#F2F2F2" class="left_txt2">应付总额</td>
                    <td width="7%" bgcolor="#F2F2F2" class="left_txt2">支付方式</td>
                    <td width="6%" bgcolor="#F2F2F2" class="left_txt2">实付现金</td>
                    <td width="7%" bgcolor="#F2F2F2" class="left_txt2">实付积分</td>
                    <td width="7%" bgcolor="#F2F2F2" class="left_txt2">状态</td>
                    <td width="11%" bgcolor="#F2F2F2" class="left_txt2">操作</td>
                  </tr>
                  <?php        
                    $_row = _num_rows($_result);
                    if ( $_row > 0 ) {
                    while ( $_rows = _fetch_array($_result) ) {
                        $_html = array();
                        $_html['id'] = $_rows['id'];
                        $_html['orderNumber'] = $_rows['orderNumber'];
                        $_html['addDates'] = $_rows['addDates'];
                        $_html['userid'] = $_rows['userid'];
                        
                        $_sql1 = "SELECT userName FROM tb_user WHERE id = '{$_html['userid']}'";
                        $_result1 = _query($_sql1);
                        $_rows1 = _fetch_array($_result1);
                        $_html['userName'] = $_rows1['userName'];

                        $_html['theGoodsName'] = $_rows['theGoodsName'];    
                        $_html['distribution'] = $_rows['distribution'];
                        $_html['theGoodsPhone'] = $_rows['theGoodsPhone'];
                        $_html['AmountPayable'] = $_rows['AmountPayable'];
                        $_html['payMoney'] = $_rows['payMoney'];
                        $_html['payIntegral'] = $_rows['payIntegral'];
                        $_html['returnIntegral'] = $_rows['returnIntegral'];
                        
                        switch ( $_rows['distribution'] ) {
                            case 1:
                                $_html['distribution'] = '快递配送';
                                break;
                            case 2:
                                $_html['distribution'] = '门店自提';
                                break;
                        }
                        switch ( $_rows['payment'] ) {
                            case 0:
                                $_html['payment'] = '未支付';
                                break;
                            case 1:
                                $_html['payment'] = '优品阁帐号';
                                break;
                            case 2:
                                $_html['payment'] = '腾讯财付通';
                                break;
                            case 3:
                                $_html['payment'] = '门店内支付';
                                break;
                        }
                        
                        switch ( $_rows['state'] ) {
                            case 0:
                                $_html['state'] = '显示';
                                break;
                            case 1:
                                $_html['state'] = '隐藏';
                                break;
                        }
                        $_html = _html($_html);
                    ?>
                  <tr class="left_txt2" align="center">
                    <td bgcolor="#F2F2F2" class="left_txt2">
                    <input name="ids[]" type="checkbox" value="<?php echo $_html["id"];?>" /></td>
                    <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html["orderNumber"];?></td>
                    <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html["addDates"];?></td>
                    <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html["userName"] ;?></td>
                    <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html["theGoodsName"];?></td>
                    <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html["theGoodsPhone"];?></td>
                    <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html["distribution"];?>                    </td>
                    <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html["AmountPayable"];?></td>
                    <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html["payment"];?></td>
                    <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html["payMoney"];?></td>
                    <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html["payIntegral"];?></td>
                    <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html["state"];?></td>
                    <td bgcolor="#F2F2F2" class="left_txt2" >
                    <a href='?action=delete&id=<?php echo $_html['id']?>'>删除</a> | 
                      <a href='order_xiangqing.php?id=<?php echo $_html['id']?>'><span style="color:#FF0000">  订单详情 </span></a> </td>
                  </tr>
                     <?php
                }
                _free_result($_result);
                _close();
                ?>
                
                  <tr>
                    <td colspan="14" bgcolor="#F2F2F2" class="left_txt2"><input type="submit" value="批量删除" />                    </td>
                  </tr>
                  <?php
                } else {
                echo "<tr><td colspan='7'><div style='text-align:center;color:red;font-size:16px;'>暂无广告位广告</div></td></tr>"; 
                }
                ?>
                </table>
              </form></td>
          </tr>
        </table>
        <div id="page">
             <?php
            _paging(2);
            ?>
        </div>
      </div></td>
    <td background="images/mail_rightbg.gif">&nbsp;</td>
  </tr>
  <tr>
    <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
    <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
    <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
  </tr>
</table>
</body>
</html>
View Code

网站设置一般用  单一的    只能修改

<?php
require 'includes/common.inc.php';
session_start();
if ( !isset($_SESSION['adminName']) ) {
    _location('请先登录','login.php');
}

//查询网站设置信息
$_result1 = _query("SELECT * FROM tb_webSite");
$_rows1 = _fetch_array($_result1);
$_html1 = array();
$_html1['id'] = $_rows1['id'];
$_html1['webCopyright'] = $_rows1['webCopyright'];
$_html1['webIcp'] = $_rows1['webIcp'];
$_html1['webService'] = $_rows1['webService'];
$_html1['webFax'] = $_rows1['webFax'];
$_html1['webEmail'] = $_rows1['webEmail'];
$_html1['webQq'] = $_rows1['webQq'];
$_html1['webLogo'] = $_rows1['webLogo'];
$_html1['gift'] = $_rows1['gift'];
$_html1 = _html($_html1);

//修改网站设置信息        
if ($_GET['action'] == 'modify'){
    $webCopyright = _check($_POST['webCopyright']);
    $webIcp = _check($_POST['webIcp']);
    $webService = _check($_POST['webService']);
    $webFax = _check($_POST['webFax']);
    $webEmail = _check($_POST['webEmail']);
    $webQq = _check($_POST['webQq']);
    if($_POST["newWebLogo"]==""){
        $webLogo = _check($_POST['webLogo']);
    }else{
        unlink("../".$_POST['webLogo']);
        $webLogo = _check($_POST['newWebLogo']);
    }
    $gift = _check($_POST['gift']);
    $_sql = "UPDATE tb_webSite SET webCopyright = '$webCopyright',webIcp = '$webIcp',webService = '$webService',webFax = '$webFax',webEmail = '$webEmail',webQq = '$webQq',webLogo = '$webLogo',gift = '$gift' WHERE id = 1";
    _query($_sql);
    if ( _affected_rows() == 1 ) {
        _close();
        _location('修改成功!','webSite.php');
    } else {
        _close();
        _alert_back('修改失败!');
    }
}
    
?>
<!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" />
<title>网站设置</title>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
        <td  valign="top" background="images/content-bg.gif">
            <table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
                <tr>
                    <td height="31">
                        <div class="titlebt">网站设置</div>
                    </td>
                </tr>
            </table>
        </td>
        <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
    </tr>
    <tr>
        <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
        <td valign="top" bgcolor="#F7F8F9">
            <div>
                <!---->
                <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                        <td height="10"> 
                    </tr>
                    <tr>
                        <td>
                            <form method="post" action="?action=modify" name="webSiteForm" id="webSiteForm">
                                <table width="100%"  cellpadding="0" cellspacing="0" class="nowtable">
                                    <tr>
                                        <td  align="right"  bgcolor="#f2f2f2" class="left_txt2">网站版权:</td>
                                        <td bgcolor="#f2f2f2" class="left_txt2">
                                            <input name="webCopyright" type="text" id="webCopyright" size="30" value="<?php echo $_html1["webCopyright"];?>"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right" bgcolor="#f2f2f2" class="left_txt2">Icp备案号:</td>
                                        <td bgcolor="#f2f2f2" class="left_txt2">
                                            <input name="webIcp" type="text" id="webIcp" size="30"   value="<?php echo $_html1["webIcp"];?>"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right" bgcolor="#f2f2f2" class="left_txt2">客服电话:</td>
                                        <td bgcolor="#f2f2f2" class="left_txt2">
                                            <input name="webService" type="text" id="webService" size="30"  value="<?php echo $_html1["webService"];?>"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right" bgcolor="#f2f2f2" class="left_txt2">传真:</td>
                                        <td bgcolor="#f2f2f2" class="left_txt2">
                                            <input name="webFax" type="text" id="webFax" size="30" value="<?php echo $_html1["webFax"];?>"/>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right" bgcolor="#f2f2f2" class="left_txt2">邮箱:</td>
                                        <td bgcolor="#f2f2f2" class="left_txt2">
                                            <input name="webEmail" type="text" id="webEmail" size="30" value="<?php echo $_html1["webEmail"];?>" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right" bgcolor="#f2f2f2" class="left_txt2">Qq群:</td>
                                        <td  bgcolor="#f2f2f2" class="left_txt2">
                                            <input name="webQq" type="text" id="webQq" size="30" value="<?php echo $_html1["webQq"];?>" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right" bgcolor="#f2f2f2" class="left_txt2">网站Logo:</td>
                                        <td  bgcolor="#f2f2f2" class="left_txt2">
                                            <input type="hidden" name="webLogo" id="webLogo" value="<?php echo $_html1["webLogo"];?>"/>
                                            <input type="text" name="newWebLogo" id="newWebLogo" size="30"/>
                                            <input type="button" value="上传" onClick="window.open('upload.php?formname=webSiteForm&editname=newWebLogo&imageUrl=images/','','status=no,scrollbars=no,top=35,width=650,height=350')"/> 注:为空则不修改
                                        </td>
                                    </tr>
                                     <tr>
                                        <td align="right" bgcolor="#f2f2f2" class="left_txt2">充值有礼:</td>
                                        <td  bgcolor="#f2f2f2" class="left_txt2">
                                        <select id="gift" name="gift">
                                            <option value="0" <?php if($_html1["gift"]==0){echo "selected='selectd'";}?>>不开启</option>
                                            <option value="1" <?php if($_html1["gift"]==1){echo "selected='selectd'";}?>>开启充值送积分</option>
                                            <option value="2" <?php if($_html1["gift"]==2){echo "selected='selectd'";}?>>开启充值送现金</option>
                                            <option value="3" <?php if($_html1["gift"]==3){echo "selected='selectd'";}?>>开启充值送实物</option>
                                        </select></td>
                                    </tr>
                                    <tr>
                                        <td colspan="4" align="center" bgcolor="#f2f2f2" class="left_txt2">
                                            <input type="submit" name="button" id="button" value="修改" />
                                        </td>
                                    </tr>
                                </table>
                            </form>
                        </td>
                    </tr>
                </table>
            </div>
        </td>
        <td background="images/mail_rightbg.gif">&nbsp;</td>
    </tr>
    <tr>
        <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
        <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
        <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
    </tr>
</table>
</body>
</html>
View Code

只能修改   查处多个id的

?php
require 'includes/common.inc.php';    
session_start();    
if ( !isset($_SESSION['adminName']) ) {
    _location('请先登录!','login.php');
}
//修改信息
if($_GET["action"]=="edit"&&isset($_GET["Giftid"])){
    $Giftid=$_GET["Giftid"];
    $Amount = _check($_POST['Amount']);
    $GiftNumber = _check($_POST['GiftNumber']);
    $Giftimage = _check($_POST['Giftimage']);
    _query("update tb_gift set Amount='$Amount',GiftNumber='$GiftNumber',Giftimage='$Giftimage' where Giftid='$Giftid'");
    if( _affected_rows() ) {
        _close();
        _location('修改成功!','gift.php');
    }else{
        _close();
        _location('修改失败!','gift.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" />
<title>充值类型</title>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
        <td  valign="top" background="images/content-bg.gif">
            <table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
                <tr>
                    <td height="31">
                        <div class="titlebt">充值管理</div>
                    </td>
                </tr>
            </table>
        </td>
        <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
    </tr>
    <tr>
        <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
        <td valign="top" bgcolor="#F7F8F9">
            <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td height="10"></td>
                </tr>
                <tr>
                    <td>
                        <table width="902" cellpadding="0" cellspacing="0" class="nowtable">
                            <tr align="center" bgcolor="#F2F2F2">
                                <td width="117" class="left_txt2">顺序</td>
                                <td width="153" class="left_txt2">类型</td>
                                <td width="159" class="left_txt2">充值金额</td>
                                <td width="149" class="left_txt2">礼品数量</td>
                                <td width="212" class="left_txt2">宣传图</td>
                                <td width="110" class="left_txt2">操作</td>
                            </tr>
                             <?php        
                            $_sql = "SELECT * FROM tb_gift";    
                            $_result = _query($_sql);
                            $_row = _num_rows($_result);
                            if ( $_row > 0 ) {
                            while ( $_rows = _fetch_array($_result) ) {
                                $_html = array();
                                $_html['Giftid'] = $_rows['Giftid'];
                                $_html['Amount'] = $_rows['Amount'];
                                $_html['GiftNumber'] = $_rows['GiftNumber'];
                                $_html['Giftimage'] = $_rows['Giftimage'];
                                $_html = _html($_html);
                            ?>
                            <form action="?action=edit&Giftid=<?php echo $_html['Giftid']?>" method="post" id="giftForm" name="giftForm">
                                <tr bgcolor="#F2F2F2" align="center">
                                <td class="left_txt2">
                                    <?php echo $_html['Giftid']?>                                </td>
                                    <td class="left_txt2">
                                        <select id="Giftid" name="Giftid">
                                            <option value="0" <?php if($_html['Giftid']==1) echo "selected='selected'";?>>充值送积分</option>
                                            <option value="1" <?php if($_html['Giftid']==2) echo "selected='selected'";?>>充值送现金</option>
                                            <option value="1" <?php if($_html['Giftid']==3) echo "selected='selected'";?>>充值送实物</option>
                                        </select>                                    </td>
                                    <td class="left_txt2">
                                        <input type="text" id="Amount" name="Amount" value="<?php echo $_html['Amount']?>" size="13" />                                    </td>
                                    <td class="left_txt2">
                                        <input type="text" id="GiftNumber" name="GiftNumber" value="<?php echo $_html['GiftNumber']?>" size="13" />                                    </td>
                                    <td class="left_txt2">
                                        <input name="Giftimage" type="text" id="Giftimage" size="15" value="<?php echo $_html['Giftimage']?>"/>
                                         &nbsp; <input type="button" value="上传" onClick="window.open('upload.php?formname=giftForm&editname= Giftimage&imageUrl=images/gift/','','status=no,scrollbars=no,top=35,width=650,height=350')"/><br />                                    </td>
                                    <td class="left_txt2"> 
                                     <input type="submit" value="修改" />
                                    </td>
                                </tr>
                          </form>
                            <?php
                            }
                            _free_result($_result);
                            _close();
                            ?>
                            <?php
                            } else {
                            echo "<tr><td colspan='7'><div style='text-align:center;color:red;font-size:16px;'>暂无信息</div></td></tr>"; 
                            }
                            ?>
                      </table>
                    </td>
                </tr>
            </table>
        </td>
        <td background="images/mail_rightbg.gif">&nbsp;</td>
    </tr>
    <tr>
        <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
        <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
        <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
    </tr>
</table>
</body>
</html>
View Code

这是一个点击选项带有帅选的功能     在同一页增删查功能

<?php
require 'includes/common.inc.php';
session_start();
if ( !isset($_SESSION['adminName']) ) {
    _location('请先登录!','login.php');
}
    
//添加广告
if ( $_GET['action'] == 'add' ) {
    $_clean = array();
    $_clean['adLocation'] = _check($_POST['adLocation']);
    $_clean['adName'] = _check($_POST['adName']);
    $_clean['adImage'] = _check($_POST['adImage']);
    $_clean['adUrl'] = _check($_POST['adUrl']);
    $_clean['state'] = _check($_POST['state']);
    $_clean['sort'] = _check($_POST['sort']);
    $_sqlAdd = "INSERT INTO tb_ad VALUES(null,'{$_clean['adName']}','{$_clean['adLocation']}','{$_clean['adImage']}','{$_clean['adUrl']}','{$_clean['sort']}','{$_clean['state']}')";
    _query($_sqlAdd);
    if ( _affected_rows() == 1 ) {
        _close();
        _location('添加成功!','ad.php');
    } else {
        _close();
        _location('添加失败!','ad.php');
    }
}

//根据id删除广告
if ( isset($_GET['id']) && $_GET['action'] = 'delete' ) {
    $_sql1 = "DELETE FROM tb_ad WHERE id = '{$_GET['id']}'";
    _query($_sql1);

    if ( _affected_rows() == 1 ) {
        _close();
        _alert_back('删除成功!');
    } else {
        _close();
        _alert_back('删除失败!');
    }
}
?>
<!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" />
<title>后台管理--广告管理</title>
<style type="text/css">
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    background-color: #F8F9FA;
}
-->
</style>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript">
function selectClick(){
    var adLocation2=document.getElementById("adLocation2").value;
    location.href="ad.php?adLocation="+adLocation2;
}
</script>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
        <td  valign="top" background="images/content-bg.gif">
            <table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
                <tr>
                    <td height="31">
                        <div class="titlebt">广告管理</div>
                    </td>
                </tr>
            </table>
        </td>
        <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
    </tr>
    <tr>
        <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
        <td valign="top" bgcolor="#F7F8F9">
            <div>
                <!---->
                <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                        <td height="10">
                            
                        </td>
                    </tr>
                    <tr>
                        <td height="30">
                         <select name="adLocation2" id="adLocation2">
                            <option value="1">head文字广告</option>
                            <option value="2">head图片广告(200*60*1)</option>
                            <option value="3">首页Banner(960*310)</option>
                            <option value="4">左边导航上部(170*atuo)</option>
                            <option value="5">首页主体下部(753*303)</option>
                            <option value="6">首页文章左部(175*120*1)</option>
                            <option value="7">类别页Banner(753*246)</option>
                            <option value="8">全部商品页Banner(753*246)</option>
                            <option value="9">企业采购页Banner(753*246)</option>
                            <option value="10">商家批发页Banner(753*246)</option>
                            <option value="11">品牌专区页Banner(753*246)</option>
                            <option value="12">help左边(170*140*1)</option>
                            <option value="13">友情链接(auto*75)</option>
                            <option value="14">积分专区页Banner(753*246)</option>
                            <option value="15">今日特惠页Banner(753*246)</option>
                        </select> 
                        <input type="button" value="确认筛选" οnclick="selectClick()"/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                           <table cellpadding="0" cellspacing="0" class="nowtable">
                                <tr align="center" >
                                    <td width="200" bgcolor="#F2F2F2" class="left_txt2"> 位置 </td>
                                    <td width="160" bgcolor="#F2F2F2" class="left_txt2" >名称</td>
                                    <td width="200" bgcolor="#F2F2F2" class="left_txt2" >图片</td>
                                    <td width="160" bgcolor="#F2F2F2" class="left_txt2">URL</td> 
                                    <td width="100" bgcolor="#F2F2F2" class="left_txt2">状态</td>
                                    <td width="100" bgcolor="#F2F2F2" class="left_txt2">排序</td>
                                    <td width="150" bgcolor="#F2F2F2" class="left_txt2" >操作</td>
                                </tr>
                                <form method="POST" action="?action=add" name="addAdForm" id="addAdForm">
                                    <tr align="center" bgcolor="#F2F2F2">
                                        <td class="left_txt2">
                                          <select name="adLocation" id="adLocation">
                                                <option value="1">head文字广告</option>
                                                <option value="2">head图片广告(200*60*1)</option>
                                                <option value="3">首页Banner(960*310)</option>
                                                <option value="4">左边导航上部(170*atuo)</option>
                                                <option value="5">首页主体下部(753*303)</option>
                                                <option value="6">首页文章左部(175*120*1)</option>
                                                <option value="7">类别页Banner(753*246)</option>
                                                <option value="8">全部商品页Banner(753*246)</option>
                                                <option value="9">企业采购页Banner(753*246)</option>
                                                <option value="10">商家批发页Banner(753*246)</option>
                                                <option value="11">品牌专区页Banner(753*246)</option>
                                                <option value="12">help左边(170*140*1)</option>
                                                <option value="13">友情链接(auto*75)</option>
                                                <option value="14">积分专区页Banner(753*246)</option>
                                                <option value="15">今日特惠页Banner(753*246)</option>
                                            </select>
                                        </td>
                                        <td class="left_txt2">
                                            <input type="text" name="adName" id="adName"/>
                                        </td>
                                        <td class="left_txt2">
                                            <input type="text" name="adImage" id="adImage" size="10"/>
                                            <input type="button" value="上传" onClick="window.open('upload.php?formname=addAdForm&editname=adImage&imageUrl=images/ads/','','status=no,scrollbars=no,top=35,width=650,height=350')"/>
                                        </td>
                                        <td class="left_txt2">
                                            <input type="text" name="adUrl" id="adUrl"/>
                                        </td>
                                        <td class="left_txt2">
                                            <select id="state" name="state">
                                                <option value="0">显示</option>
                                                <option value="1">隐藏</option>
                                            </select>
                                        </td>
                                        <td class="left_txt2">
                                            <input type="text" name="sort" id="sort" style="width:90px"/>
                                        </td>
                                        <td class="left_txt2">
                                            <input type="submit" value="添加" />
                                            <input type="reset" value="重置"/>
                                        </td>
                                    </tr>
                                </form>
                                <?php    
                                define('SCRIPT','ad');
                                global $_pagesize,$_pagenum;
                                if ($_GET['adLocation']=="") {
                                    _page('SELECT id FROM tb_ad',10);
                                    $_sql = "SELECT * FROM tb_ad LIMIT $_pagenum,$_pagesize";
                                }else{
                                    _page("SELECT id FROM tb_ad WHERE adLocation = '{$_GET['adLocation']}'",10);
                                    $_sql = "SELECT * FROM tb_ad WHERE adLocation = '{$_GET['adLocation']}' LIMIT $_pagenum,$_pagesize";    
                                }
                                $_result = _query($_sql);    
                                $_row = _num_rows($_result);
                                if ( $_row > 0 ) {
                                    while ( $_rows = _fetch_array($_result) ) {
                                        $_html = array();
                                        $_html['id'] = $_rows['id'];
                                        $_html['adName'] = $_rows['adName'];
                                        switch ( $_rows['adLocation'] ) {
                                            case 1:
                                                $_html['adLocation'] = 'head文字广告';
                                                break;
                                            case 2:
                                                $_html['adLocation'] = 'head图片广告(200*60*1)';
                                                break;
                                            case 3:
                                                $_html['adLocation'] = '首页Banner(960*310)';
                                                break;
                                            case 4:
                                                $_html['adLocation'] = '左边导航上部(170*atuo)';
                                                break;
                                            case 5:
                                                $_html['adLocation'] = '首页主体下部(753*303)';
                                                break;
                                            case 6:
                                                $_html['adLocation'] = '首页文章左部(175*120*1)';
                                                break;
                                            case 7:
                                                $_html['adLocation'] = '类别页Banner(753*246)';
                                                break;
                                            case 8:
                                                $_html['adLocation'] = '全部商品页Banner(753*246)';
                                                break;
                                            case 9:
                                                $_html['adLocation'] = '企业采购页Banner(753*246)';
                                                break;
                                            case 10:
                                                $_html['adLocation'] = '商家批发页Banner(753*246)';
                                                break;
                                            case 11:
                                                $_html['adLocation'] = '品牌专区页Banner(753*246)';
                                                break;
                                            case 12:
                                                $_html['adLocation'] = 'help左边(170*140*1)';
                                                break;
                                            case 13:
                                                $_html['adLocation'] = '友情链接(auto*75)';
                                                break;
                                            case 14:
                                                $_html['adLocation'] = '积分专区页Banner(753*246)';
                                                break;    
                                            case 15:
                                                $_html['adLocation'] = '今日特惠页Banner(753*246)';
                                            
                                        }
                                        $_html['adImage'] = $_rows['adImage'];
                                        $_html['adUrl'] = $_rows['adUrl'];
                                        
                                        switch ( $_rows['state'] ) {
                                            case 0:
                                                $_html['state'] = '显示';
                                                break;
                                            case 1:
                                                $_html['state'] = '隐藏';
                                                break;
                                        }
                                        $_html['sort'] = $_rows['sort'];
                                        $_html = _html($_html);
                                ?>
                                <tr bgcolor="#F2F2F2" align="center" >
                                    <td class="left_txt2"><?php echo $_html['adLocation']?></td>
                                    <td class="left_txt2"><?php echo $_html['adName']?></td>
                                    <td class="left_txt2"><?php echo $_html["adImage"]?></td>
                                    <td class="left_txt2"><?php echo $_html["adUrl"]?></td>                                
                                    <td class="left_txt2"><?php echo $_html["state"]?></td>
                                    <td class="left_txt2"><?php echo $_html["sort"]?></td>
                                    <td class="left_txt2">
                                    <a href='?action=delete&id=<?php echo $_html['id']?>'>删除</a> | 
                                    <a href='ad_edit.php?id=<?php echo $_html['id']?>'>修改</a> 
                                    </td>
                                </tr>
                                <?php
                                    }
                                ?>
                                <?php
                                } else {
                                ?>
                                <tr bgcolor="#F2F2F2" class="left_txt2" align="center" >
                                    <td colspan="7">暂无广告</td>
                                </tr>
                                <?php    
                                }
                                _free_result($_result);
                                _close();
                                ?>
                                <tr bgcolor="#F2F2F2" class="left_txt2" align="center" >
                                    <td colspan="7">
                                    <?php 
                                    if($_GET['adLocation']=="") {
                                        _paging(2);
                                    }else{
                                        _paging_parameter(2,"adLocation='{$_GET['adLocation']}'");
                                    }
                                    
                                    ?>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </div>
        <td background="images/mail_rightbg.gif">&nbsp;</td>
        </td>
    </tr>
    <tr>
        <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
        <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
        <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
    </tr>
</table>
</body>
</html>
View Code

省份添加 更改  查找  删除

添加省份
<?php
require 'includes/common.inc.php';    
session_start();    
if ( !isset($_SESSION['adminName']) ) {
    _location('请先登录!','login.php');
}

//添加省
if($_GET["action"]=="add"){
    $areaName=$_POST["areaName"];
    $sort=$_POST["sort"];
    $state=$_POST["state"];
    _query("insert into tb_area values(null,1,0,'$areaName','$sort','$state')");
    if( _affected_rows() ) {
        _close();
        _location('省份添加成功!','area.php');
    }else{
        _close();
        _location('省份添加失败!','area.php');
    }
}    

//修改省信息
if($_GET["action"]=="updateProvince"&&isset($_GET["provinceId"])){
    $provinceId=$_GET["provinceId"];
    $areaName = _check($_POST['areaName']);
    $sort = _check($_POST['sort']);
    $state = _check($_POST['state']);
    
    _query("update tb_area set areaName='$areaName',sort='$sort',state='$state' where id='$provinceId'");
    if( _affected_rows() ) {
        _close();
        _location('省修改成功!','area.php');
    }else{
        _close();
        _location('省修改失败!','area.php');
    }
}    

//根据id删除省信息    
if ( $_GET['action'] == 'delete' && isset($_GET['id']) ) {
    $_sql1 = "DELETE FROM tb_area WHERE id = '{$_GET['id']}'";
    _query($_sql1);

    if ( _affected_rows() == 1 ) {
        _close();
        _alert_back('删除成功!');
    } else {
        _close();
        _alert_back('删除失败!');
    }
}

?>
<!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" />
<title>省份管理</title>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript">
function updateProvince(provinceId){
    document.getElementById("updateProvinceForm"+provinceId+"").submit();
}

</script>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
        <td  valign="top" background="images/content-bg.gif">
            <table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
                <tr>
                    <td height="31">
                        <div class="titlebt">省份管理</div>
                    </td>
                </tr>
            </table>
        </td>
        <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
    </tr>
    <tr>
        <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
        <td valign="top" bgcolor="#F7F8F9">
            <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td height="10"></td>
                </tr>
                <tr>
                    <td>
                        <table cellpadding="0" cellspacing="0" class="nowtable">
                            <tr align="center" bgcolor="#F2F2F2">
                                <td width="160" class="left_txt2">省</td>
                                <td width="160" class="left_txt2">排序</td>
                                <td width="60" class="left_txt2">状态</td>
                                <td width="150" class="left_txt2">操作</td>
                            </tr>
                            <form action="?action=add" method="post" >
                            <tr align="center" bgcolor="#F2F2F2">
                                <td class="left_txt2">
                                    <input type="text" name="areaName" id="areaName"/>
                                </td>
                                <td class="left_txt2">
                                    <input name="sort" type="text" id="sort"/>
                                </td>
                                <td class="left_txt2">
                                    <select id="state" name="state">
                                        <option value="0">正常</option>
                                        <option value="1">隐藏</option>
                                    </select>
                                </td>
                                <td class="left_txt2">
                                    <input type="submit" value="添加"/>
                                    <input type="reset" value="重置"/>
                                </td>
                            </tr>
                            </form>
                            <?php
                            $_sql="select * from tb_area where areaType=1";
                            $_result = _query($_sql);
                            if ( _num_rows($_result) > 0 ) {
                                while ( $_rows = _fetch_array($_result) ) {
                            ?>
                            <form action="?action=updateProvince&provinceId=<?php echo $_rows['id']?>" method="post" id="updateProvinceForm<?php echo $_rows['id']?>">
                                <tr bgcolor="#F2F2F2" align="center">
                                    <td class="left_txt2">
                                        <input type="text" id="areaName" name="areaName" value="<?php echo $_rows["areaName"];?>" />
                                    </td>
                                    <td class="left_txt2">
                                        <input type="text" id="sort" name="sort" value="<?php echo $_rows["sort"];?>" />
                                    </td>
                                    <td class="left_txt2">
                                        <select id="state" name="state">
                                            <option value="0" <?php if($_rows["state"]==0) echo "selected='selected'";?>>正常</option>
                                            <option value="1" <?php if($_rows["state"]==1) echo "selected='selected'";?>>隐藏</option>
                                        </select>
                                    </td>
                                    <td class="left_txt2"> 
                                    <a href='?action=delete&id=<?php echo $_rows['id']?>'>删除</a> | 
                                    <a href='javascript:void(0)' οnclick="updateProvince(<?php echo $_rows['id'];?>)">修改</a> | 
                                    <a href='area_city.php?provinceId=<?php echo $_rows['id'];?>'><span style="color:#FF0000">城市管理</span></a> </td>
                                </tr>
                            </form>
                            <?php
                                }
                            }
                            _free_result($_result);
                              ?>
                        </table>
                    </td>
                </tr>
            </table>
        </td>
        <td background="images/mail_rightbg.gif">&nbsp;</td>
    </tr>
    <tr>
        <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
        <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
        <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
    </tr>
</table>
</body>
</html>

添加市区

<?php
require 'includes/common.inc.php';
session_start();
if ( !isset($_SESSION['adminName']) ) {
    _location('请先登录!','login.php');
}

//添加城市
if($_GET["action"]=="addCity"&&isset($_GET["provinceId"])){
    $areaId=$_GET["provinceId"];
    $areaName=$_POST["areaName"];
    $sort=$_POST["sort"];
    $state=$_POST["state"];
    _query("insert into tb_area values(null,2,'$areaId','$areaName','$sort','$state')");
    if( _affected_rows() ) {
        _close();
        _location('地市添加成功!','area_city.php?provinceId='.$areaId);
    }else{
        _close();
        _location('地市添加失败!','area_city.php?provinceId='.$areaId);
    }
}

//修改城市
if($_GET["action"]=="updateCity"&&isset($_GET["cityId"])){
    $provinceId=$_GET["provinceId"];
    $cityId=$_GET["cityId"];
    $areaName=$_POST["areaName"];
    $sort=$_POST["sort"];
    $state=$_POST["state"];
    _query("update tb_area set areaName='$areaName',sort='$sort',state='$state' where id='$cityId'");
    if( _affected_rows() ) {
        _close();
        _location('城市修改成功!','area_city.php?provinceId='.$provinceId);
    }else{
        _close();
        _location('城市修改失败!','area_city.php?provinceId='.$provinceId);
    }
}

//删除一条地区信息
if ( $_GET['action'] == 'deleteCity' && isset($_GET['cityId']) ) {
    $provinceId=$_GET["provinceId"];
    $_sql1 = "DELETE FROM tb_area WHERE id = '{$_GET['cityId']}'";
    _query($_sql1);

    if ( _affected_rows() == 1 ) {
        _close();
        _location('地市删除成功!','area_city.php?provinceId='.$provinceId);
    } else {
        _close();
        _location('地市删除失败!','area_city.php?provinceId='.$provinceId);
    }
}
?>
<!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" />
<title>城市管理</title>
<script type="text/javascript">
function updateCity(cityId){
    document.getElementById("updateCityForm"+cityId+"").submit();
}

</script>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
        <td  valign="top" background="images/content-bg.gif">
            <table width="160" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
                <tr>
                    <td height="31">
                        <div class="titlebt">城市管理</div>
                    </td>
                </tr>
            </table>
        </td>
        <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
    </tr>
    <tr>
        <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
        <td valign="top" bgcolor="#F7F8F9">
            <div>
                <!---->
                <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                        <td height="10"></td>
                    </tr>
                    <tr>
                        <td>
                            <table height="106" border="0" cellpadding="0" cellspacing="0" class="nowtable">
                                <tr align="center" bgcolor="#F2F2F2">
                                    <td width="285" class="left_txt2">名称</td>
                                    <td width="270" class="left_txt2">排序</td>
                                    <td width="278" class="left_txt2">状态</td>
                                    <td width="295" class="left_txt2">操作</td>
                                </tr>
                                <form action="?action=addCity&provinceId=<?php echo $_GET['provinceId']?>" method="post" >
                                <tr align="center" bgcolor="#F2F2F2">
                                    <td class="left_txt2">
                                        <input type="text" name="areaName" id="areaName" size="15"/>
                                    </td>
                                    <td class="left_txt2">
                                        <input type="text" name="sort" id="sort" style="width:90px"/>
                                    </td>
                                    <td class="left_txt2">
                                        <select name="state" id="state" style="width:90px">
                                            <option value="0">正常 </option>
                                            <option value="1">隐藏</option>
                                        </select>
                                    </td>
                                    <td class="left_txt2">
                                        <input type="submit" value="添加"/>
                                        <input type="reset" value="重置"/>
                                    </td>
                                </tr>
                                </form>
                                <?php
                                $_sql="select * from tb_area where areaType=2 and areaId='{$_GET['provinceId']}'";
                                $_result = _query($_sql);
                                $_row = _num_rows($_result);
                                if ( $_row > 0 ) {
                                    while ( $_rows = _fetch_array($_result) ) {
                                ?>
                                <form action="?action=updateCity&cityId=<?php echo $_rows['id']?>&provinceId=<?php echo $_GET['provinceId']?>" method="post" id="updateCityForm<?php echo $_rows['id']?>">
                                    <tr align="center" bgcolor="#F2F2F2">
                                        <td  class="left_txt2">
                                            <input type="text" name="areaName" value="<?php echo $_rows['areaName']?>"  size="15"/>
                                        </td>
                                        <td  class="left_txt2">
                                            <input type="text" name="sort" value="<?php echo $_rows['sort']?>" style="width:90px"/>
                                        </td>
                                        <td class="left_txt2">
                                            <select name="state" style="width:90px">
                                                <option value="0" <?php if($_rows['state']==0){echo "selected='selected'";}?>>正常 </option>
                                                <option value="1" <?php if($_rows['state']==1){echo "selected='selected'";}?>>隐藏</option>
                                            </select>
                                        </td>
                                        <td bgcolor="#F2F2F2" class="left_txt2">
                                        <a href='javascript:void(0)' οnclick="updateCity(<?php echo $_rows['id'];?>)">修改</a> | 
                                        <a href='?action=deleteCity&cityId=<?php echo $_rows['id'];?>&provinceId=<?php echo $_GET['provinceId']?>'>删除</a> | 
                                        <a href='area_county.php?cityId=<?php echo $_rows['id'];?>'><span style="color:#FF0000;">区县管理</span></a>
                                        </td>
                                    </tr>
                                </form>
                                <?php
                                    }
                                _free_result($_result);
                                }
                                ?>                
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td height="10"></td>
                    </tr>
                    <tr>
                        <td></td>
                    </tr>
                </table>
            </div>
        </td>
        <td background="images/mail_rightbg.gif">&nbsp;</td>
    </tr>
    <tr>
        <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
        <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
        <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
    </tr>
</table>
</body>
</html>


添加商圈
<?php
require 'includes/common.inc.php';
session_start();
if ( !isset($_SESSION['adminName']) ) {
    _location('请先登录!','login.php');
}

//添加区县
if($_GET["action"]=="addCounty"&&isset($_GET["cityId"])){
    $areaId=$_GET["cityId"];
    $areaName=$_POST["areaName"];
    $sort=$_POST["sort"];
    $state=$_POST["state"];
    _query("insert into tb_area values(null,3,'$areaId','$areaName','$sort','$state')");
    if( _affected_rows() ) {
        _close();
        _location('区县添加成功!','area_county.php?cityId='.$areaId);
    }else{
        _close();
        _location('区县添加失败!','area_county.php?cityId='.$areaId);
    }
}

//修改区县
if($_GET["action"]=="updateCounty"&&isset($_GET["countyId"])){
    $cityId=$_GET["cityId"];
    $countyId=$_GET["countyId"];
    $areaName=$_POST["areaName"];
    $sort=$_POST["sort"];
    $state=$_POST["state"];
    _query("update tb_area set areaName='$areaName',sort='$sort',state='$state' where id='$countyId'");
    if( _affected_rows() ) {
        _close();
        _location('区县修改成功!','area_county.php?cityId='.$cityId);
    }else{
        _close();
        _location('区县修改失败!','area_county.php?cityId='.$cityId);
    }
}

//删除一条地区信息
if ( $_GET['action'] == 'deleteCounty' && isset($_GET['countyId']) ) {
    $cityId=$_GET["cityId"];
    $_sql1 = "DELETE FROM tb_area WHERE id = '{$_GET['countyId']}'";
    _query($_sql1);

    if ( _affected_rows() == 1 ) {
        _close();
        _location('区县删除成功!','area_county.php?cityId='.$cityId);
    } else {
        _close();
        _location('区县删除失败!','area_county.php?cityId='.$cityId);
    }
}
?>
<!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" />
<title>区县管理</title>
<script type="text/javascript">
function updateCounty(countyId){
    document.getElementById("updateCountyForm"+countyId+"").submit();
}

</script>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
        <td  valign="top" background="images/content-bg.gif">
            <table width="160" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
                <tr>
                    <td height="31">
                        <div class="titlebt">区县管理</div>
                    </td>
                </tr>
            </table>
        </td>
        <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
    </tr>
    <tr>
        <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
        <td valign="top" bgcolor="#F7F8F9">
            <div>
                <!---->
                <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                        <td height="10"></td>
                    </tr>
                    <tr>
                        <td>
                            <table height="31" border="0" cellpadding="0" cellspacing="0" class="nowtable">
                                <tr align="center" bgcolor="#F2F2F2">
                                    <td width="283" class="left_txt2">名称</td>
                                    <td width="326" class="left_txt2">排序</td>
                                    <td width="276" class="left_txt2">状态</td>
                                    <td width="260" class="left_txt2">操作</td>
                                </tr>
                                <form action="?action=addCounty&cityId=<?php echo $_GET['cityId']?>" method="post" >
                                <tr align="center" bgcolor="#F2F2F2">
                                    <td class="left_txt2">
                                        <input type="text" name="areaName" id="areaName" size="15"/>
                                    </td>
                                    <td bgcolor="#F2F2F2" class="left_txt2">
                                        <input type="text" name="sort" id="sort" style="width:90px"/>
                                    </td>
                                    <td bgcolor="#F2F2F2" class="left_txt2">
                                        <select name="state" id="state" style="width:90px">
                                            <option value="0">正常 </option>
                                            <option value="1">隐藏</option>
                                        </select>
                                    </td>
                                    <td bgcolor="#F2F2F2" class="left_txt2">
                                        <input type="submit" value="添加"/>
                                        <input type="reset" value="重置"/>
                                    </td>
                                </tr>
                                </form>
                                <?php
                                $_sql="select * from tb_area where areaType=3 and areaId='{$_GET['cityId']}'";
                                $_result = _query($_sql);
                                $_row = _num_rows($_result);
                                if ( $_row > 0 ) {
                                    while ( $_rows = _fetch_array($_result) ) {
                                ?>
                                <form action="?action=updateCounty&countyId=<?php echo $_rows['id']?>&cityId=<?php echo $_GET['cityId']?>" method="post" id="updateCountyForm<?php echo $_rows['id']?>">
                                    <tr align="center">
                                        <td bgcolor="#F2F2F2" class="left_txt2">
                                            <input type="text" name="areaName" size="15" value="<?php echo $_rows['areaName']?>" />
                                        </td>
                                        <td bgcolor="#F2F2F2" class="left_txt2">
                                            <input type="text" name="sort" value="<?php echo $_rows['sort']?>" style="width:90px"/>
                                        </td>
                                        <td bgcolor="#F2F2F2" class="left_txt2">
                                            <select name="state" style="width:90px">
                                                <option value="0" <?php if($_rows['state']==0){echo "selected='selected'";}?>>正常 </option>
                                                <option value="1" <?php if($_rows['state']==1){echo "selected='selected'";}?>>隐藏</option>
                                            </select>
                                        </td>
                                        <td bgcolor="#F2F2F2" class="left_txt2"> 
                                        <a href='javascript:void(0)' οnclick="updateCounty(<?php echo $_rows['id'];?>)">修改</a> | 
                                        <a href='?action=deleteCounty&countyId=<?php echo $_rows['id']?>&cityId=<?php echo $_GET['cityId']?>'>删除</a> 
                                        </td>
                                    </tr>
                                </form>
                                <?php
                
                                    }
                                    _free_result($_result);
                                }
                                ?>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td height="10"></td>
                    </tr>
                    <tr>
                        <td></td>
                    </tr>
                </table>
            </div>
        </td>
        <td background="images/mail_rightbg.gif">&nbsp;</td>
    </tr>
    <tr>
        <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
        <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
        <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
    </tr>
</table>
</body>
</html>
View Code

添加大类小类

大类
<?php
require 'includes/common.inc.php';    
session_start();
if ( !isset($_SESSION['adminName']) ) {
    _location('请先登录!','login.php');
}
    
//添加一级类
if($_GET["action"]=="add"){
    $categoryName=$_POST["categoryName"];
    $sort=$_POST["sort"];
    $grade=$_POST["grade"];
    $state=$_POST["state"];
    _query("insert into tb_category values(null,'$categoryName',0,'$grade','$sort','$state')");
    if( _affected_rows() ) {
        _close();
        _location('添加成功!','categorybig.php');
    }else{
        _close();
        _location('添加失败!','categorybig.php');
    }
}    

if($_GET["action"]=="updateBigClass"&&isset($_GET["bigClassId"])){
    $categoryName = _check($_POST['categoryName']);
    $sort = _check($_POST['sort']);
    $state = _check($_POST['state']);
    $_sql = "UPDATE tb_category SET categoryName = '$categoryName',sort = '$sort',state = '$state' WHERE id = '{$_GET['bigClassId']}'";
    _query($_sql);
    if ( _affected_rows() == 1 ) {
        _close();
        _location('修改成功!','categorybig.php');
    } else {
        _close();
        _alert_back('修改失败!');
    }
}

//删除一级类
if ($_GET['action'] == 'delete' && isset($_GET['id']) ) {
    $_sql1 = "DELETE FROM tb_category WHERE id = '{$_GET['id']}'";
    _query($_sql1);
    if ( _affected_rows() == 1 ) {
        _close();
        _alert_back('删除成功!');
    } else {
        _close();
        _alert_back('删除失败!');
    }
}

?>
<!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" />
<title>后台管理--省份管理</title>
<style type="text/css">
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    background-color: #F8F9FA;
}
-->
</style>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function updateBigClass(bigClassId){
    document.getElementById("updateBigClassForm"+bigClassId+"").submit();
}
</script>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
        <td  valign="top" background="images/content-bg.gif">
            <table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
                <tr>
                    <td height="31">
                        <div class="titlebt">一级类管理</div>
                    </td>
                </tr>
            </table>
        </td>
        <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
    </tr>
    <tr>
        <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
        <td valign="top" bgcolor="#F7F8F9">
            <div>
                <!---->
                <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                        <td height="10"></td>
                    </tr>
                    <tr>
                        <td>
                            <table cellpadding="0" cellspacing="0" class="nowtable">
                                <tr align="center" bgcolor="#F2F2F2">
                                    <td width="100" class="left_txt2">类型</td>
                                    <td width="150" class="left_txt2">名称</td>
                                    <td width="150" class="left_txt2">排序</td>
                                    <td width="100" class="left_txt2">状态</td>
                                    <td width="150" class="left_txt2">操作</td>
                                </tr>
                                <form action="?action=add" method="post" >
                                <tr align="center" bgcolor="#F2F2F2">
                                    <td class="left_txt2">
                                        <select id="grade" name="grade" >
                                            <option value="1">商品大类</option>
                                            <option value="11">帮助分类</option>
                                        </select>
                                    </td>
                                    <td class="left_txt2">
                                        <input name="categoryName" type="text" id="categoryName" size="15" />
                                    </td>
                                    <td class="left_txt2">
                                        <input name="sort" type="text" id="sort" size="15" />
                                    </td>
                                    <td class="left_txt2">
                                        <select id="state" name="state">
                                            <option value="0">正常</option>
                                            <option value="1">隐藏</option>
                                        </select>
                                    </td>
                                    <td class="left_txt2">
                                        <input type="submit" value="添加"/>
                                        <input type="reset" value="重置"/>
                                    </td>
                                </tr>
                                </form>
                                <?php
                                $_sql="select * from tb_category where categoryId=0";
                                $_result = _query($_sql);
                                $_row = _num_rows($_result);
                                if ( $_row > 0 ) {
                                    while ( $_rows = _fetch_array($_result) ) {
                                ?>
                                <form action="?action=updateBigClass&bigClassId=<?php echo $_rows['id']?>" method="post" id="updateBigClassForm<?php echo $_rows['id']?>">
                                    <tr bgcolor="#F2F2F2" align="center">
                                        <td class="left_txt2">
                                        <?php
                                        if($_rows["grade"]==1){
                                            echo "商品大类";
                                        }elseif($_rows["grade"]==11){
                                            echo "商品信息";
                                        }
                                        ?>
                                        </td>
                                        <td class="left_txt2">
                                            <input id="categoryName" name="categoryName" size="15" value="<?php echo $_rows["categoryName"];?>" />
                                        </td>
                                        <td class="left_txt2">
                                            <input id="sort" name="sort" size="15" value="<?php echo $_rows["sort"];?>" />
                                        </td>
                                        <td class="left_txt2">
                                            <select id="state" name="state">
                                                <option value="0" <?php if($_rows["state"]==0) echo "selected";?>>正常</option>
                                                <option value="1" <?php if($_rows["state"]==1) echo "selected";?>>隐藏</option>
                                            </select>
                                        </td>
                                        <td class="left_txt2"> 
                                        <a href='?action=delete&id=<?php echo $_rows['id']?>'>删除</a> | 
                                        <a href='javascript:void(0)' οnclick="updateBigClass(<?php echo $_rows['id'];?>)">修改</a> | 
                                        <a href='categorysmall.php?bigClassId=<?php echo $_rows['id'];?>'><span style="color:#FF0000">二级类管理</span></a> </td>
                                    </tr>
                                </form>
                                <?php
                                }
                                    }
                                _free_result($_result);
                                ?>
                        
                            </table>
                        </td>
                    </tr>
                </table>
                <div id="page"></div>
            </div>
        </td>
        <td background="images/mail_rightbg.gif">&nbsp;</td>
    </tr>
    <tr>
        <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
        <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
        <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
    </tr>
</table>
</body>
</html>


小类


<?php
require 'includes/common.inc.php';
session_start();    
if ( !isset($_SESSION['adminName']) ) {
    _location('请先登录!','login.php');
}

//添加二级类
if($_GET["action"]=="addSmallClass" && isset($_GET["bigClassId"])){
    $categoryId=$_GET["bigClassId"];
    $categoryName=$_POST["categoryName"];
    $grade=$_POST["grade"];
    $sort=$_POST["sort"];
    $state=$_POST["state"];
    _query("insert into tb_category values (null,'$categoryName','$categoryId','$grade','$sort','','$state')");
    if( _affected_rows() == 1 ) {
        _close();
        _location('添加成功!','categorysmall.php?bigClassId='.$categoryId);
    }else{
        _close();
        _location('添加失败!','categorysmall.php?bigClassId='.$categoryId);
    }
}

//修改二级类
if($_GET["action"]=="update"&&isset($_GET["id"])){
    $bigClassId=$_GET["bigClassId"];
    $categoryName=$_POST["categoryName".$smallClassId.""];
    $sort=$_POST["sort".$smallClassId.""];
    $state=$_POST["state".$smallClassId.""];
    _query("update tb_category set categoryName='$categoryName',sort='$sort',state='$state' where id='{$_GET['id']}'");
    if( _affected_rows() ) {
        _close();
        _location('修改成功!','categorysmall.php?bigClassId='.$bigClassId);
    }else{
        _close();
        _location('修改失败!','categorysmall.php?bigClassId='.$bigClassId);
    }
}

//删除二级类
if ($_GET['action'] == 'delete' && isset($_GET['id']) ) {
    $bigClassId=$_GET["bigClassId"];
    $_sql1 = "DELETE FROM tb_category WHERE id = '{$_GET['id']}'";
    _query($_sql1);

    if ( _affected_rows() == 1 ) {
        _close();
        _location('删除成功!','categorysmall.php?bigClassId='.$bigClassId);
    } else {
        _close();
        _location('删除失败!','categorysamll.php?bigClassId='.$bigClassId);
    }
}
?>
<!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" />
<title>二级类管理</title>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function updateSmallClass(id){
    document.getElementById("updateSmalCLassForm"+id+"").submit();
}
</script>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
        <td  valign="top" background="images/content-bg.gif">
            <table width="160" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
                <tr>
                    <td height="31">
                        <div class="titlebt">二级类管理</div>
                    </td>
                </tr>
            </table>
        </td>
        <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
    </tr>
    <tr>
        <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
        <td valign="top" bgcolor="#F7F8F9">
            <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td height="10"></td>
                </tr>
                <tr>
                    <td>
                        <table cellpadding="0" cellspacing="0" class="nowtable">
                            <tr align="center" bgcolor="#F2F2F2">
                                <td width="100" class="left_txt2">类型</td>
                                <td width="150" class="left_txt2">名称</td>
                                <td width="150" class="left_txt2">排序</td>
                                <td width="100" class="left_txt2">状态</td>
                                <td width="150" class="left_txt2">操作</td>
                            </tr>
                            <form action="?action=addSmallClass&bigClassId=<?php echo $_GET['bigClassId']?>" method="post" >
                            <tr align="center" bgcolor="#F2F2F2">
                                <td class="left_txt2">
                                    <select id="grade" name="grade" >
                                        <option value="2">商品小类</option>
                                        <option value="3">商品品牌</option>
                                        <option value="4">商品可配送区域</option>
                                        <option value="5">商品属性分类</option>
                                        <option value="6">商品原产地</option>
                                        <option value="7">商品适应人群</option>
                                        <option value="8">商品产品功效</option>
                                        <option value="9">商品保质期</option>
                                        <option value="10">商品储存</option>
                                    </select>
                                </td>
                                <td class="left_txt2">
                                    <input name="categoryName" type="text" id="categoryName" size="15" />
                                </td>
                                <td class="left_txt2">
                                    <input name="sort" type="text" id="sort" size="15" />
                                </td>
                                <td class="left_txt2">
                                    <select id="state" name="state" style="width:90px">
                                        <option value="0">正常</option>
                                        <option value="1">隐藏</option>
                                    </select>
                                </td>
                                <td class="left_txt2"><a></a>
                                    <input type="submit" value="添加"/>
                                    <input type="reset" value="重置"/>
                                </td>
                            </tr>
                            </form>
                            <?php
                            $_sql="select * from tb_category where categoryId='{$_GET['bigClassId']}'";
                            $_result = _query($_sql);
                            $_row = _num_rows($_result);
                            if ( $_row > 0 ) {
                                while ( $_rows = _fetch_array($_result) ) {
                                $_html['id'] = $_rows['id'];
                                $_html['categoryId'] = $_rows['categoryId'];
                                $_html['categoryName'] = $_rows['categoryName'];
                                $_html['sort'] = $_rows['sort'];
                                $_html['state'] = $_rows['state'];
                                
                                switch ( $_rows['grade'] ) {
                                case 2:
                                $_html['grade'] = '商品小类';
                                break;
                                case 3:
                                $_html['grade'] = '商品品牌';
                                break;
                                case 4:
                                $_html['grade'] = '商品可配送区域';
                                break;
                                case 5:
                                $_html['grade'] = '商品属性分类';
                                break;
                                case 6:
                                $_html['grade'] = '商品原产地';
                                break;
                                case 7:
                                $_html['grade'] = '商品适应人群';
                                break;
                                case 8:
                                $_html['grade'] = '商品产品功效';
                                break;
                                case 9:
                                $_html['grade'] = '商品保质期';
                                break;
                                case 10:
                                $_html['grade'] = '商品储存';
                                break;
                                }
                                $_html = _html($_html);    
                            ?>
                            <form action="?action=update&id=<?php echo $_html['id']?>&bigClassId=<?php echo $_GET['bigClassId']?>" method="post" id="updateSmalCLassForm<?php echo $_html['id']?>">
                            <tr align="center" bgcolor="#F2F2F2">
                                <td class="left_txt2"><?php echo $_html['grade']?> </td>
                                <td class="left_txt2">
                                    <input type="text" name="categoryName" value="<?php echo $_html['categoryName']?>" size="15"/>
                                <td class="left_txt2">
                                    <input type="text" name="sort" value="<?php echo $_html['sort']?>" size="15"/>
                                </td>
                                <td class="left_txt2">
                                    <select name="state" style="width:90px">
                                        <option value="0" <?php if($_html['state']==0){echo "selected='selected'";}?>>正常 </option>
                                        <option value="1" <?php if($_html['state']==1){echo "selected='selected'";}?>>隐藏</option>
                                    </select>
                                </td>
                                <td class="left_txt2">
                                <a href='?action=delete&id=<?php echo $_html['id']?>&bigClassId=<?php echo $_GET['bigClassId']?>'>删除</a> |
                                <a href='javascript:void(0)' οnclick="updateSmallClass(<?php echo $_html['id']?>)">修改</a>
                                </td>
                            </tr>
                            </form>
                            <?php
                                }
                            }
                            _free_result($_result); 
                            ?>
                        </table>
                    </td>
                </tr>
            </table>
        </td>
        <td background="images/mail_rightbg.gif">&nbsp;</td>
    </tr>
    <tr>
        <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
        <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
        <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
    </tr>
</table>
</body>
</html>
View Code

 查处多条数据   只实现修改功能

<?php
require 'includes/common.inc.php';    
session_start();    
if ( !isset($_SESSION['adminName']) ) {
    _location('请先登录!','login.php');
}
//修改信息
if($_GET["action"]=="edit"&&isset($_GET["Giftid"])){
    $Giftid=$_GET["Giftid"];
    $Amount = _check($_POST['Amount']);
    $GiftNumber = _check($_POST['GiftNumber']);
    $Giftimage = _check($_POST['Giftimage']);
    _query("update tb_gift set Amount='$Amount',GiftNumber='$GiftNumber',Giftimage='$Giftimage' where Giftid='$Giftid'");
    if( _affected_rows() ) {
        _close();
        _location('修改成功!','gift.php');
    }else{
        _close();
        _location('修改失败!','gift.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" />
<title>充值类型</title>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
        <td  valign="top" background="images/content-bg.gif">
            <table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
                <tr>
                    <td height="31">
                        <div class="titlebt">充值管理</div>
                    </td>
                </tr>
            </table>
        </td>
        <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
    </tr>
    <tr>
        <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
        <td valign="top" bgcolor="#F7F8F9">
            <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td height="10"></td>
                </tr>
                <tr>
                    <td>
                        <table width="902" cellpadding="0" cellspacing="0" class="nowtable">
                            <tr align="center" bgcolor="#F2F2F2">
                                <td width="117" class="left_txt2">顺序</td>
                                <td width="153" class="left_txt2">类型</td>
                                <td width="159" class="left_txt2">充值金额</td>
                                <td width="149" class="left_txt2">礼品数量</td>
                                <td width="212" class="left_txt2">宣传图</td>
                                <td width="110" class="left_txt2">操作</td>
                            </tr>
                             <?php        
                            $_sql = "SELECT * FROM tb_gift";    
                            $_result = _query($_sql);
                            $_row = _num_rows($_result);
                            if ( $_row > 0 ) {
                            while ( $_rows = _fetch_array($_result) ) {
                                $_html = array();
                                $_html['Giftid'] = $_rows['Giftid'];
                                $_html['Amount'] = $_rows['Amount'];
                                $_html['GiftNumber'] = $_rows['GiftNumber'];
                                $_html['Giftimage'] = $_rows['Giftimage'];
                                $_html = _html($_html);
                            ?>
                            <form action="?action=edit&Giftid=<?php echo $_html['Giftid']?>" method="post" id="giftForm" name="giftForm">
                                <tr bgcolor="#F2F2F2" align="center">
                                <td class="left_txt2">
                                    <?php echo $_html['Giftid']?>                                </td>
                                    <td class="left_txt2">
                                        <select id="Giftid" name="Giftid">
                                            <option value="0" <?php if($_html['Giftid']==1) echo "selected='selected'";?>>充值送积分</option>
                                            <option value="1" <?php if($_html['Giftid']==2) echo "selected='selected'";?>>充值送现金</option>
                                            <option value="1" <?php if($_html['Giftid']==3) echo "selected='selected'";?>>充值送实物</option>
                                        </select>                                    </td>
                                    <td class="left_txt2">
                                        <input type="text" id="Amount" name="Amount" value="<?php echo $_html['Amount']?>" size="13" />                                    </td>
                                    <td class="left_txt2">
                                        <input type="text" id="GiftNumber" name="GiftNumber" value="<?php echo $_html['GiftNumber']?>" size="13" />                                    </td>
                                    <td class="left_txt2">
                                        <input name="Giftimage" type="text" id="Giftimage" size="15" value="<?php echo $_html['Giftimage']?>"/>
                                         &nbsp; <input type="button" value="上传" onClick="window.open('upload.php?formname=giftForm&editname= Giftimage&imageUrl=images/gift/','','status=no,scrollbars=no,top=35,width=650,height=350')"/><br />                                    </td>
                                    <td class="left_txt2"> 
                                     <input type="submit" value="修改" />
                                    </td>
                                </tr>
                          </form>
                            <?php
                            }
                            _free_result($_result);
                            _close();
                            ?>
                            <?php
                            } else {
                            echo "<tr><td colspan='7'><div style='text-align:center;color:red;font-size:16px;'>暂无信息</div></td></tr>"; 
                            }
                            ?>
                      </table>
                    </td>
                </tr>
            </table>
        </td>
        <td background="images/mail_rightbg.gif">&nbsp;</td>
    </tr>
    <tr>
        <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
        <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
        <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
    </tr>
</table>
</body>
</html>
View Code

留言接收与发送

<?php
    require 'includes/common.inc.php';
    session_start();
    if ( !isset($_SESSION['adminName']) ) {
        _location('请先登录!','user_login.php');
    }
    
    define('SCRIPT','Messageliuyan');

        global $_pagesize,$_pagenum;
        
        _page('SELECT id FROM tb_sendMessage',10);
        $_sql = "SELECT * FROM tb_sendMessage  LIMIT $_pagenum,$_pagesize";    
        $_result = _query("select u.userName,s.id,s.fromuser,s.touser,s.messageTitle,s.content,s.state,s.sendTime,s.sendIP,s.sendIP,messageType from tb_sendMessage as s,tb_user as u where u.id=s.fromuser");
?>
<!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" />
<title>无标题文档</title>
<style type="text/css">
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    background-color: #F8F9FA;
}
-->
</style>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
    <td  valign="top" background="images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
        <tr>
          <td height="31"><div class="titlebt">留言管理</div></td>
        </tr>
      </table></td>
    <td width="17" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
  </tr>
  <tr>
    <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9"><div>
        <!---->
        <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td class="left_txt">当前位置:留言列表</td>
          </tr>
          <tr>
            <td><table width="100%" height="56" border="0" cellpadding="0" cellspacing="0" class="nowtable">
                <tr align="center">
                  <td width="10%" bgcolor="#F2F2F2" class="left_txt2">发件人</td>
                  <td width="11%" bgcolor="#F2F2F2" class="left_txt2">收件人</td>
                  <td width="12%" bgcolor="#F2F2F2" class="left_txt2">信息标题</td>
                  <td width="21%" bgcolor="#F2F2F2" class="left_txt2">内容</td>
                  <td width="17%" bgcolor="#F2F2F2" class="left_txt2">发送时间</td>
                  <td width="13%" bgcolor="#F2F2F2" class="left_txt2">发送IP</td>
                  <td width="16%" bgcolor="#F2F2F2" class="left_txt2">状态</td>                
                </tr>
                      <?php        
                    $_row = _num_rows($_result);
                    if ( $_row > 0 ) {
                    while ( $_rows = _fetch_array($_result) ) {
                        $_html = array();
                        $_html['id'] = $_rows['id'];
                        $_html['userName'] = $_rows['userName'];
                        $_html['touser'] = $_rows['touser'];
                        $_html['messageTitle'] = $_rows['messageTitle'];
                        $_html['content'] = $_rows['content'];
                        $_html['sendTime'] = $_rows['sendTime'];
                        $_html['sendIP'] = $_rows['sendIP'];
                        $_html['messageType'] = $_rows['messageType'];
                        switch ( $_rows['state'] ) {
                            case 0:
                                $_html['state'] = '未读';
                                break;
                            case 1:
                                $_html['state'] = '已读';
                                break;
                        }
                        $_html = _html($_html);
                    ?>
                <tr class="left_txt2" align="center">
                  <td height="27" bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html["userName"];?></td>
                  <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html["touser"];?></td>
                  <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html["messageTitle"] ;?></td>
                  <td bgcolor="#F2F2F2" class="left_txt2">
                   <a href='Messagehuifu.php?id=<?php echo $_html['id']?>'><span style="color:#FF0000"><?php echo mb_substr($_html["content"],0,40);?></span></a> 
                 </td>
                  <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html["sendTime"] ;?></td>
                  <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html["sendIP"];?></td>
                  <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html["state"];?></td>
                </tr>
                 <?php
                    }
                    _free_result($_result);
                    _close();
                    ?>
                  <?php
                    } else {
                    echo "<tr><td colspan='7'><div style='text-align:center;color:red;font-size:16px;'>暂无信息</div></td></tr>"; 
                    }
                    ?>
              </table></td>
          </tr>
        </table>
        <div id="page">
          <?php
          _paging(2);
          ?>
        </div>
      </div></td>
    <td background="images/mail_rightbg.gif">&nbsp;</td>
  </tr>
  <tr>
    <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
    <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
    <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
  </tr>
</table>
</body>
</html>


回复

<?php
    require 'includes/common.inc.php';
    session_start();
    if ( !isset($_SESSION['adminName']) ) {
        _location('请先登录!','login.php');
    }
    
    $_now = date('Y-m-d H:i:s',time());
    $_ip = getIP();
    
    if ( isset($_GET['id']) ) {
        $_sql = "UPDATE tb_sendMessage SET state = 1 WHERE id = '{$_GET['id']}'";
        _query($_sql);
    
        $_sql1 = "SELECT fromuser,touser,content FROM tb_sendMessage WHERE id = '{$_GET['id']}'";
        $_result1 = _query($_sql1);
        $_rows1 = _fetch_array($_result1);
        $_html1 = array();
        $_html1['fromuser'] = $_rows1['fromuser'];
        $_html1['touser'] = $_rows1['touser'];
        $_html1['content'] = $_rows1['content'];
        $_html1 = _html($_html1);
        
        if ( $_GET['action'] == 'rearticle' ) {
            $_clean = array();
            $_clean['content'] = _check($_POST['content']);
            
            $_sqlAdd = "INSERT INTO tb_returnMessasge VALUES (null,'{$_html1['touser']}','{$_GET['id']}','{$_clean['content']}',0,'$_now','$_ip')";
        
            _query($_sqlAdd);
            
            if ( _affected_rows() == 1 ) {
                _close();
                _location('回复成功!','index.php');
            } else {
                _close();
                _location('回复失败!','Messagehuifu.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" />
<title>无标题文档</title>
<style type="text/css">
<!--
*{
margin:0;
padding:0;}
body {
    background-color: #F8F9FA;
}
-->
</style>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
    <td  valign="top" background="images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
        <tr>
          <td height="31"><div class="titlebt">留言管理</div></td>
        </tr>
      </table></td>
    <td width="17" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
  </tr>
  <tr>
    <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9"><div>
        <!---->
        <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td class="left_txt">当前位置:回复留言</td>
          </tr>
          <tr>
            <td><table width="100%" height="207" border="0" cellpadding="0" cellspacing="0" class="nowtable">
            
                 <tr class="left_txt2" align="center">
                    <td width="36%" height="112" align="right" bgcolor="#F2F2F2" class="left_txt2">内容</td>
                   <td bgcolor="#F2F2F2" class="left_txt2" align="left" colspan="2"><?php echo $_html1['content']?></td>
                </tr>
                <form method="post" action="?action=rearticle">
                  <tr class="left_txt2" align="center">
                    <td width="36%" bgcolor="#F2F2F2" class="left_txt2" align="right">回复内容</td>
                    <td bgcolor="#F2F2F2" class="left_txt2" align="left" colspan="2"><textarea name="content" id="content" cols="42" rows="5"></textarea>
                    </td>
                  </tr>
                  <tr class="left_txt2" align="center">
                    <td bgcolor="#F2F2F2" class="left_txt2" colspan="3"><input value="回复" class="button" type="submit"></td>
                  </tr>
                </form>
              </table></td>
          </tr>
        </table>
      </div></td>
    <td background="images/mail_rightbg.gif">&nbsp;</td>
  </tr>
  <tr>
    <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
    <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
    <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
  </tr>
</table>
</body>
</html>
View Code

 商品的  多级帅选  查找  添加  修改

列表
<?php
require 'includes/common.inc.php';
session_start();    
if ( !isset($_SESSION['adminName']) ) {
    _location('请先登录!','login.php');
}
if ( isset($_GET['id']) && $_GET['action'] = 'delete' ) {
    $_sql1 = "DELETE FROM tb_GoodsInfo WHERE id = '{$_GET['id']}'";
    _query($_sql1);
    
    if ( _affected_rows() == 1 ) {
        _close();
        _alert_back('删除成功!');
    } else {
        _close();
        _alert_back('删除失败!');
    }
}
?>
<!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" />
<title>商品管理</title>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
        <td valign="top" background="images/content-bg.gif">
            <table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
                <tr>
                    <td height="31">
                        <div class="titlebt">商品管理</div>
                    </td>
                </tr>
            </table>
        </td>
        <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
    </tr>
    <tr>
        <td height="71" valign="middle" background="images/mail_leftbg.gif"></td>
        <td valign="top" bgcolor="#F7F8F9">
            <div style="overflow-x:scroll">
            <table border="0" cellpadding="0" cellspacing="0" >
                <tr>
                    <td height="10"></td>
                </tr>
                <tr>
                    <td style="font-size:12px">
                    <form action="GoodsInfo.php" method="post">
                    <select name="GoodType" id="GoodType">
                        <option value="0" selected="selected">商品类型</option>
                        <option value="1">普通商品</option>
                        <option value="2">抢特惠</option>
                        <option value="3">企业采购</option>
                        <option value="4">批发商品</option>
                        <option value="6">秒杀下期预告商品</option>
                        <option value="7">充值有礼实物礼品</option>
                    </select>
                    <select name="state" id="state">
                        <option value="-1">状态</option>
                        <option value="0">上架</option>
                        <option value="1">下架</option>
                    </select>
                    <select name="selling" id="selling">
                        <option value="-1">热卖</option>
                        <option value="0">否</option>
                        <option value="1">是</option>
                    </select>
                    <select name="specialOffer" id="specialOffer">
                        <option value="-1" selected="selected">特价</option>
                        <option value="0">否</option>
                        <option value="1">是</option>
                    </select>
                    <select name="recommendedGoods" id="recommendedGoods">
                        <option value="-1" selected="selected">推荐</option>
                        <option value="0">否</option>
                        <option value="1">是</option>
                    </select>
                    <select name="newGoods" id="newGoods">
                        <option value="-1" selected="selected">最新</option>
                        <option value="0">否</option>
                        <option value="1">是</option>
                    </select>
                    <input type="text" name="GoodsName" id="GoodsName" value="商品名称"/>
                    <input type="submit" value="搜索" />
                    </form>
                    </td>
                </tr>
                <tr>
                    <td>
                        
                        <form action="?action=deleteAll" id='deleteAll' method="post" >
                        <table cellpadding="0" cellspacing="0" class="nowtable">
                            <tr align="center" bgcolor="#F2F2F2">
                                <td width="70" class="left_txt2">商品类型</td>
                                <td width="70" class="left_txt2">大类</td>
                                <td width="70" class="left_txt2">商品货号</td>
                                <td width="70" class="left_txt2">浏览次数</td>
                                <td width="250" class="left_txt2">商品名称</td>
                                <td width="50" class="left_txt2">市场价</td>
                                <td width="50" class="left_txt2">会员价</td>
                                <td width="70" class="left_txt2">返还积分</td>
                                <td width="70" class="left_txt2">优惠积分</td>
                                <td width="50" class="left_txt2">邮费</td>
                                <td width="50" class="left_txt2">排序</td>
                                <td width="50" class="left_txt2">状态</td>
                                <td width="50" class="left_txt2">热卖</td>
                                <td width="50" class="left_txt2">推荐</td>
                                <td width="50" class="left_txt2">最新</td>
                                <td width="80" class="left_txt2">操作</td>
                            </tr>
                            <?php
                            define('SCRIPT','GoodsInfo');
                            global $_pagesize,$_pagenum;
                            
                            if($_POST["GoodType"]>0){
                                $parm1="and GoodType=".$_POST["GoodType"];
                            }
                            if($_POST["state"]>-1){
                                $parm2="and state=".$_POST["state"];
                            }
                            if($_POST["selling"]>-1){
                                $parm3="and selling=".$_POST["selling"];
                            }
                            if($_POST["specialOffer"]>-1){
                                $parm4="and specialOffer=".$_POST["specialOffer"];
                            }
                            if($_POST["recommendedGoods"]>-1){
                                $parm5="and recommendedGoods=".$_POST["recommendedGoods"];
                            }
                            if($_POST["newGoods"]>-1){
                                $parm6="and newGoods=".$_POST["newGoods"];
                            }
                            if($_POST["GoodsName"]<>"商品名称"){
                                $parm7="and GoodsName like '%".$_POST["GoodsName"]."%'";
                            }
                            $parm=
                            _page("SELECT id FROM tb_GoodsInfo where 1 ".$parm1." ".$parm2." ".$parm3." ".$parm4." ".$parm5." ".$parm6." ".$parm7."",20);
                                $_sql = "SELECT tb_GoodsInfo.id,tb_category.categoryName,tb_GoodsInfo.GoodType,tb_GoodsInfo.bigClassId,tb_GoodsInfo.articleNumber,tb_GoodsInfo.viewed,tb_GoodsInfo.GoodsName,tb_GoodsInfo.marketPrice,tb_GoodsInfo.memberPrice,tb_GoodsInfo.returnIntegral,tb_GoodsInfo.preferential,tb_GoodsInfo.postagePrice,tb_GoodsInfo.sort,tb_GoodsInfo.state,tb_GoodsInfo.selling,tb_GoodsInfo.recommendedGoods,tb_GoodsInfo.newGoods from tb_GoodsInfo,tb_category where tb_GoodsInfo.bigClassId = tb_category.id ".$parm1." ".$parm2." ".$parm3." ".$parm4." ".$parm5." ".$parm6." ".$parm7." order by tb_GoodsInfo.sort,tb_GoodsInfo.id  LIMIT $_pagenum,$_pagesize";
                            $_result=_query($_sql);
                            if ( _num_rows($_result) > 0 ) {
                                while ( $_rows = _fetch_array($_result) ) {
                            ?>
                            <tr bgcolor="#F2F2F2" align="center">   
                                <td bgcolor="#F2F2F2" class="left_txt2">
                                <?php
                                if($_rows['GoodType']==1){
                                    echo "普通商品";
                                }elseif($_rows['GoodType']==2){
                                    echo "抢特惠";
                                }elseif($_rows['GoodType']==3){
                                    echo "企业采购";
                                }elseif($_rows['GoodType']==4){
                                    echo "批发商品";
                                }elseif($_rows['GoodType']==5){
                                    echo "秒杀商品";
                                }elseif($_rows['GoodType']==6){
                                    echo "秒杀下期预告商品";
                                }elseif($_rows['GoodType']==7){
                                    echo "充值有礼实物礼品";
                                }
                                ?>
                                </td>
                                <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_rows['categoryName'] ?></td>    
                                <td class="left_txt2"><?php echo $_rows['articleNumber']?></td>
                                <td class="left_txt2"><?php echo $_rows['viewed']?></td>
                                <td class="left_txt2" align="left"><?php echo $_rows['GoodsName']?></td>
                                <td class="left_txt2"><?php echo $_rows['marketPrice']?></td>
                                <td class="left_txt2"><?php echo $_rows['memberPrice']?></td>
                                <td class="left_txt2"><?php echo $_rows['returnIntegral']?></td>
                                <td class="left_txt2"><?php echo $_rows['preferential']?></td>
                                <td class="left_txt2"><?php echo $_rows['postagePrice']?></td>
                                <td class="left_txt2"><?php echo $_rows['sort']?></td>
                                <td class="left_txt2">
                                <?php
                                if($_rows['state']==0){
                                    echo "显示中";
                                }elseif($_rows['state']==1){
                                    echo "已下架";
                                }
                                ?>
                                </td>
                                <td class="left_txt2">
                                <?php
                                if($_rows['selling']==0){
                                    echo "";
                                }elseif($_rows['selling']==1){
                                    echo "";
                                }
                                ?>
                                </td>
                                <td class="left_txt2">
                                <?php
                                if($_rows['recommendedGoods']==0){
                                    echo "";
                                }elseif($_rows['recommendedGoods']==1){
                                    echo "";
                                }
                                ?>
                                </td>
                                <td class="left_txt2">
                                <?php
                                if($_rows['newGoods']==0){
                                    echo "";
                                }elseif($_rows['newGoods']==1){
                                    echo "";
                                }
                                ?>
                                </td>
                                <td class="left_txt2">
                                <a href='GoodsInfo.php?action=delete&id=<?php echo $_rows['id']?>'>删除</a> &nbsp;|&nbsp;
                                <a href='GoodsInfo_edit.php?id=<?php echo $_rows['id']?>'>详情</a>                                </td>
                            </tr>
                            <?php
                                }
                            }
                            _free_result($_result);
                            ?>
                            <tr bgcolor="#F2F2F2" align="center">
                                <td colspan="16" class="left_txt2">
                                <?php
                                _paging(2);        
                                ?>
                                </td>
                            </tr>
                        </table>
                        </form>
                    </td>
                </tr>
            </table>
            </div>
        </td>
        <td background="images/mail_rightbg.gif">&nbsp;</td>
    </tr>
    <tr>
        <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
        <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
        <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
    </tr>
</table>
</body>
</html>



添加
<?php
    //ini_set("error_reporting","E_ALL & ~E_NOTICE");
require 'includes/common.inc.php';
session_start();
if ( !isset($_SESSION['adminName']) ) {
    _location('请先登录!','login.php');
}
if ( $_GET['action'] == 'add' ) {
    $GoodType = _check($_POST['GoodType']);
    $GoodsName = _check($_POST['GoodsName']);
    $GoodsPic = _check($_POST['GoodsPic']);
    $GoodsPic2 = _check($_POST['GoodsPic2']);
    $GoodsPic3 = _check($_POST['GoodsPic3']);
    $marketPrice = _check($_POST['marketPrice']);
    $memberPrice = _check($_POST['memberPrice']);
    $returnIntegral = _check($_POST['returnIntegral']);
    $preferential = _check($_POST['preferential']);
    $postagePrice = _check($_POST['postagePrice']);
    $bigClassId = _check($_POST['bigClassId']);
    $smallClassId = _check($_POST['smallClassId']);
    $brand = _check($_POST['brand']);
    $distributionArea = _check($_POST['distributionArea']);
    $articleNumber = _check($_POST['articleNumber']);
    $weight = _check($_POST['weight']);
    $selling = _check($_POST['selling']);
    $recommendedGoods = _check($_POST['recommendedGoods']);
    $newGoods = _check($_POST['newGoods']);
    $describeGoods = _check($_POST['describeGoods']);
    $introduceGoods = _check($_POST['introduceGoods']);
    $sort = _check($_POST['sort']);
    $state = _check($_POST['state']);
    $numberOf = _check($_POST['numberOf']);
    $_sqlAdd = "INSERT INTO tb_GoodsInfo VALUES (null,'$GoodType',now(),'$GoodsName','$GoodsPic','$GoodsPic2','$GoodsPic3','$marketPrice','$memberPrice','$returnIntegral','$preferential','$postagePrice','$bigClassId','$smallClassId','$brand','$distributionArea','$articleNumber','$weight',0,'$selling','$recommendedGoods','$newGoods','$describeGoods','$introduceGoods','$sort','$state','$numberOf')";
    _query($_sqlAdd);
    if ( _affected_rows() == 1 ) {
        _close();
        _location('添加成功!','GoodsInfo.php');
    } else {
        _close();
        _location('添加失败!','GoodsInfo_add.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" />
<title>上传商品</title>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
<link href="../umeditor-utf8-php/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="../umeditor-utf8-php/third-party/jquery.min.js"></script>
<script type="text/javascript" src="../umeditor-utf8-php/umeditor.config.js" charset="utf-8"></script>
<script type="text/javascript" src="../umeditor-utf8-php/umeditor.min.js" charset="utf-8"></script>
<script type="text/javascript" src="../umeditor-utf8-php/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">

//商品小类 数据保存到数组
var smallClass = new Array();
<?php
$rs = _query("select * from tb_category where grade = 2 and state=0 order by sort asc");
$counts = 0;
while( $row = _fetch_array($rs) ){
?>
smallClass[<?php echo $counts ?>] = new Array('<?php echo $row["categoryId"]?>','<?php echo $row["id"]?>','<?php echo $row["categoryName"]?>')
<?php
$counts = $counts + 1;
}
_free_result($rs);
?>

//商品品牌
var brandArray = new Array();
<?php
$rs = _query("select * from tb_category where grade = 3 and state=0 order by sort asc");
$counts = 0;
while( $row = _fetch_array($rs) ){
?>
brandArray[<?php echo $counts ?>] = new Array('<?php echo $row["categoryId"]?>','<?php echo $row["id"]?>','<?php echo $row["categoryName"]?>')
<?php
$counts = $counts + 1;
}
_free_result($rs);
?>

//商品可配送区域
var distributionAreaArray = new Array();
<?php
$rs = _query("select * from tb_category where grade = 4 and state=0 order by sort asc");
$counts = 0;
while( $row = _fetch_array($rs) ){
?>
distributionAreaArray[<?php echo $counts ?>] = new Array('<?php echo $row["categoryId"]?>','<?php echo $row["id"]?>','<?php echo $row["categoryName"]?>')
<?php
$counts = $counts + 1;
}
_free_result($rs);
?>

//商品属性分类
var attributeClassArray = new Array();
<?php
$rs = _query("select * from tb_category where grade = 5 and state=0 order by sort asc");
$counts = 0;
while( $row = _fetch_array($rs) ){
?>
attributeClassArray[<?php echo $counts ?>] = new Array('<?php echo $row["categoryId"]?>','<?php echo $row["id"]?>','<?php echo $row["categoryName"]?>')
<?php
$counts = $counts + 1;
}
_free_result($rs);
?>

//商品原产地
var countryOfOriginArray = new Array();
<?php
$rs = _query("select * from tb_category where grade = 6 and state=0 order by sort asc");
$counts = 0;
while( $row = _fetch_array($rs) ){
?>
countryOfOriginArray[<?php echo $counts ?>] = new Array('<?php echo $row["categoryId"]?>','<?php echo $row["id"]?>','<?php echo $row["categoryName"]?>')
<?php
$counts = $counts + 1;
}
_free_result($rs);
?>

//商品适应人群
var adaptCrowdArray = new Array();
<?php
$rs = _query("select * from tb_category where grade = 7 and state=0 order by sort asc");
$counts = 0;
while( $row = _fetch_array($rs) ){
?>
adaptCrowdArray[<?php echo $counts ?>] = new Array('<?php echo $row["categoryId"]?>','<?php echo $row["id"]?>','<?php echo $row["categoryName"]?>')
<?php
$counts = $counts + 1;
}
_free_result($rs);
?>

//商品功效
var productEfficacyArray = new Array();
<?php
$rs = _query("select * from tb_category where grade = 8 and state=0 order by sort asc");
$counts = 0;
while( $row = _fetch_array($rs) ){
?>
productEfficacyArray[<?php echo $counts ?>] = new Array('<?php echo $row["categoryId"]?>','<?php echo $row["id"]?>','<?php echo $row["categoryName"]?>')
<?php
$counts = $counts + 1;
}
_free_result($rs);
?>

//商品保质期
var shelfLifeArray = new Array();
<?php
$rs = _query("select * from tb_category where grade = 9 and state=0 order by sort asc");
$counts = 0;
while( $row = _fetch_array($rs) ){
?>
shelfLifeArray[<?php echo $counts ?>] = new Array('<?php echo $row["categoryId"]?>','<?php echo $row["id"]?>','<?php echo $row["categoryName"]?>')
<?php
$counts = $counts + 1;
}
_free_result($rs);
?>

//商品储存
var storagesArray = new Array();
<?php
$rs = _query("select * from tb_category where grade = 10 and state=0 order by sort asc");
$counts = 0;
while( $row = _fetch_array($rs) ){
?>
storagesArray[<?php echo $counts ?>] = new Array('<?php echo $row["categoryId"]?>','<?php echo $row["id"]?>','<?php echo $row["categoryName"]?>')
<?php
$counts = $counts + 1;
}
_free_result($rs);
?>

function getBigClass(locationid) {
    document.addGoodsForm.smallClassId.length = 0;
    document.addGoodsForm.smallClassId.options[0] = new Option('请选择商品小类','0');
    for ( i=0; i<smallClass.length; i++ ) {
        if( smallClass[i][0] == locationid ) {
            document.addGoodsForm.smallClassId.options[document.addGoodsForm.smallClassId.length] = new Option(smallClass[i][2],smallClass[i][1]);
        }
    }
    
    document.addGoodsForm.brand.length = 0;
    document.addGoodsForm.brand.options[0] = new Option('请选择商品品牌','0');
    for ( i=0; i<brandArray.length; i++ ) {
        if( brandArray[i][0] == locationid ) {
            document.addGoodsForm.brand.options[document.addGoodsForm.brand.length] = new Option(brandArray[i][2],brandArray[i][1]);
        }
    }
    
    document.addGoodsForm.distributionArea.length = 0;
    document.addGoodsForm.distributionArea.options[0] = new Option('请选择商品可配送区域','0');
    for ( i=0; i<distributionAreaArray.length; i++ ) {
        if( distributionAreaArray[i][0] == locationid ) {
            document.addGoodsForm.distributionArea.options[document.addGoodsForm.distributionArea.length] = new Option(distributionAreaArray[i][2],distributionAreaArray[i][1]);
        }
    }
    
    document.addGoodsForm.attributeClass.length = 0;
    document.addGoodsForm.attributeClass.options[0] = new Option('请选择商品属性分类','0');
    for ( i=0; i<attributeClassArray.length; i++ ) {
        if( attributeClassArray[i][0] == locationid ) {
            document.addGoodsForm.attributeClass.options[document.addGoodsForm.attributeClass.length] = new Option(attributeClassArray[i][2],attributeClassArray[i][1]);
        }
    }
    
    document.addGoodsForm.countryOfOrigin.length = 0;
    document.addGoodsForm.countryOfOrigin.options[0] = new Option('请选择商品原产地','0');
    for ( i=0; i<countryOfOriginArray.length; i++ ) {
        if( countryOfOriginArray[i][0] == locationid ) {
            document.addGoodsForm.countryOfOrigin.options[document.addGoodsForm.countryOfOrigin.length] = new Option(countryOfOriginArray[i][2],countryOfOriginArray[i][1]);
        }
    }
    
    document.addGoodsForm.adaptCrowd.length = 0;
    document.addGoodsForm.adaptCrowd.options[0] = new Option('请选择商品适应人群','0');
    for ( i=0; i<adaptCrowdArray.length; i++ ) {
        if( adaptCrowdArray[i][0] == locationid ) {
            document.addGoodsForm.adaptCrowd.options[document.addGoodsForm.adaptCrowd.length] = new Option(adaptCrowdArray[i][2],adaptCrowdArray[i][1]);
        }
    }
    
    document.addGoodsForm.productEfficacy.length = 0;
    document.addGoodsForm.productEfficacy.options[0] = new Option('请选择商品功效','0');
    for ( i=0; i<productEfficacyArray.length; i++ ) {
        if( productEfficacyArray[i][0] == locationid ) {
            document.addGoodsForm.productEfficacy.options[document.addGoodsForm.productEfficacy.length] = new Option(productEfficacyArray[i][2],productEfficacyArray[i][1]);
        }
    }
    
    document.addGoodsForm.shelfLife.length = 0;
    document.addGoodsForm.shelfLife.options[0] = new Option('请选择商品保质期','0');
    for ( i=0; i<shelfLifeArray.length; i++ ) {
        if( shelfLifeArray[i][0] == locationid ) {
            document.addGoodsForm.shelfLife.options[document.addGoodsForm.shelfLife.length]=new Option(shelfLifeArray[i][2],shelfLifeArray[i][1]);
        }
    }
    
    document.addGoodsForm.storages.length = 0;
    document.addGoodsForm.storages.options[0] = new Option('请选择商品储存','0');
    for ( i=0; i<storagesArray.length; i++ ) {
        if( storagesArray[i][0] == locationid ) {
            document.addGoodsForm.storages.options[document.addGoodsForm.storages.length]=new Option(storagesArray[i][2],storagesArray[i][1]);
        }
    }
}
</script>
<script language="javascript">
function $(obj){return document.getElementById(obj);}
function show(objid) {$(objid).style.display='inline';}
function hidden(objid) {$(objid).style.display='none';}
function doit(){
var sel_val=$('GoodType').value;
    if (sel_val=='') {hidden('numberOf');}
    if (sel_val==1) {hidden('numberOf');}
    if (sel_val==2) {hidden('numberOf');}
    if (sel_val==3) {hidden('numberOf');}
    if (sel_val==4) {hidden('numberOf');}
    if (sel_val==5) {show('numberOf');}
    if (sel_val==6) {show('numberOf');}
    if (sel_val==7) {hidden('numberOf');}
}
</script>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
        <td valign="top" background="images/content-bg.gif">
            <table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
                <tr>
                    <td height="31">
                        <div class="titlebt">上传商品</div>
                    </td>
                </tr>
            </table>
        </td>
        <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
    </tr>
    <tr>
        <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
        <td valign="top" bgcolor="#F7F8F9">
            <div>
                <!---->
                <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                        <td height="10"></td>
                    </tr>
                    <tr>
                        <td>
                            <form action="?action=add" method="post" name="addGoodsForm" id="addGoodsForm">
                                <table cellpadding="0" cellspacing="0" class="nowtable">
                                    <tr bgcolor="#F2F2F2">
                                        <td width="154" align="right" class="left_txt2">商品类型:</td>
                                        <td width="352" class="left_txt2">
                                            <select id="GoodType" name="GoodType" οnchange="javascript:doit();">
                                                <option value="1">普通商品</option>
                                                <option value="2">抢特惠</option>
                                                <option value="3">企业采购</option>
                                                <option value="4">批发商品</option>
                                                <option value="5">秒杀商品</option>
                                                <option value="6">秒杀下期预告商品</option>
                                                <option value="7">充值有礼实物礼品</option>
                                      </select>                                        </td>
                                        <td width="102" align="right" class="left_txt2">商品名称:</td>
                                        <td width="338" class="left_txt2">
                                      <input name="GoodsName" type="text" id="GoodsName"/>                                        </td> 
                                    </tr>
                                    <tr bgcolor="#F2F2F2">
                                         <td class="left_txt2" align="right">商品图片:</td>
                                        <td class="left_txt2">
                                            大图:
                                              <input name="GoodsPic" type="text" id="GoodsPic"/>
                                          <input type="button" value="上传" onClick="window.open('upload.php?formname=addGoodsForm&editname= GoodsPic&imageUrl=images/GoodsImages/','','status=no,scrollbars=no,top=35,width=650,height=350')"/><br />
                                            小图:
                                            <input name="GoodsPic2" type="text" id="GoodsPic2"/>
                                          <input type="button" value="上传" onClick="window.open('upload.php?formname=addGoodsForm&editname= GoodsPic2&imageUrl=images/GoodsImages/','','status=no,scrollbars=no,top=35,width=650,height=350')"/><br />
                                            手机:
                                            <input name="GoodsPic3" type="text" id="GoodsPic3"/>
                                            <input type="button" value="上传" onClick="window.open('upload.php?formname=addGoodsForm&editname= GoodsPic3&imageUrl=images/GoodsImages/','','status=no,scrollbars=no,top=35,width=650,height=350')"/>
                                            首页长条 </td>
                                         <td class="left_txt2" align="right">商品市场价:</td>
                                        <td class="left_txt2">
                                            <input name="marketPrice" type="text" id="marketPrice"/>                                        </td>
                                    </tr>
                                    <tr bgcolor="#F2F2F2">
                                        <td class="left_txt2" align="right">会员价/批发价/企业采购价:</td>
                                        <td class="left_txt2">
                                            <input name="memberPrice" type="text" id="memberPrice"/>                                        </td>
                                        <td class="left_txt2" align="right">返还积分数:</td>
                                        <td class="left_txt2">
                                            <input name="returnIntegral" type="text" id="returnIntegral"/>                                        </td>
                                    </tr>
                                    <tr bgcolor="#F2F2F2">
                                         <td class="left_txt2" align="right">优惠积分:</td>
                                        <td class="left_txt2">
                                            <input name="preferential" type="text" id="preferential"/>                                        </td>
                                         <td class="left_txt2" align="right">邮费:</td>
                                        <td class="left_txt2">
                                            <input name="postagePrice" type="text" id="postagePrice"/>                                        </td>
                                    </tr>
                                    <tr bgcolor="#F2F2F2">
                                        <td class="left_txt2" align="right">商品大类:</td>
                                        <td class="left_txt2">
                                        <select name="bigClassId" id="bigClassId" οnchange="getBigClass(this.value)">
                                            <option value="0">请选择商品大类</option>
                                            <?php
                                            $_sql4 = "SELECT id,categoryName FROM tb_category WHERE grade = 1 AND categoryId = 0 AND state = 0";
                                            $_result4 = _query($_sql4);
                                                while( $_rows4 = _fetch_array($_result4) ){    
                                            ?>
                                            <option value="<?php echo $_rows4['id'] ?>"><?php echo $_rows4['categoryName'] ?></option>
                                            <?php
                                                }
                                            _free_result($_result4);
                                            ?>
                                        </select>                                        </td>
                                        <td class="left_txt2" align="right">商品小类:</td>
                                        <td class="left_txt2">
                                            <select name="smallClassId" id="smallClassId" >
                                                <option value="0">请选择商品小类</option>
                                            </select>                                        </td>
                                    </tr>
                                    <tr bgcolor="#F2F2F2">
                                        <td class="left_txt2" align="right">商品品牌:</td>
                                        <td class="left_txt2">
                                        <select name="bigClassId" id="bigClassId" οnchange="getBigClass(this.value)">
                                            <option value="0">请选择牌</option>
                                            <?php
                                            $_sql5 = "SELECT id,categoryName FROM tb_category WHERE grade = 3 AND categoryId = 0 AND state = 0";
                                            $_result5 = _query($_sql5);
                                                while( $_rows5 = _fetch_array($_result5) ){    
                                            ?>
                                            <option value="<?php echo $_rows5['id'] ?>"><?php echo $_rows5['categoryName'] ?></option>
                                            <?php
                                                }
                                            _free_result($_result5);
                                            ?>
                                        </select>                                      </td>
                                        <td class="left_txt2" align="right">商品可配送区域:</td>
                                        <td class="left_txt2">
                                        <select name="distributionArea" id="distributionArea">
                                            <option value="0">请选择商品可配送区域</option>
                                            <?php
                                            $_sql6 = "SELECT id,areaName FROM tb_area WHERE areaType = 2  AND state = 0";
                                            $_result6 = _query($_sql6);
                                                while( $_rows6 = _fetch_array($_result6) ){    
                                            ?>
                                            <option value="<?php echo $_rows6['id'] ?>"><?php echo $_rows6['areaName'] ?></option>
                                            <?php
                                                }
                                            _free_result($_result6);
                                            ?>
                                        </select></td>
                                    </tr>
                                    <tr bgcolor="#F2F2F2">    
                                        <td class="left_txt2" align="right">货号:</td>
                                        <td class="left_txt2">
                                            <input name="articleNumber" type="text" id="articleNumber"/>                                        </td>
                                        <td class="left_txt2" align="right">重量:</td>
                                        <td class="left_txt2"><input name="weight" type="text" id="weight"/>                                        </td>
                                    </tr>
                                    <tr bgcolor="#F2F2F2">  
                                        <td class="left_txt2" align="right">推荐:</td>
                                        <td class="left_txt2">
                                            <select id="recommendedGoods" name="recommendedGoods">
                                                <option value="0">否</option>
                                                <option value="1">是</option>
                                            </select>
                                            <span class="left_txt2">(首页和侧边的猜你喜欢)</span>                                        </td>
                                        <td align="right" class="left_txt2">最新:</td>
                                        <td class="left_txt2">
                                            <select id="newGoods" name="newGoods">
                                                <option value="0">否</option>
                                                <option value="1">是</option>
                                            </select>
                                            <span class="left_txt2"> (首页)</span>                                        </td>
                                    </tr>
                                    
                                    <tr bgcolor="#F2F2F2">  
                                        <td class="left_txt2" align="right">排序:</td>
                                        <td class="left_txt2">
                                            <input type="text" name="sort" id="sort"/>                                        </td>
                                        <td align="right" class="left_txt2">状态:</td>
                                        <td class="left_txt2">
                                            <select id="state" name="state">
                                                <option value="0">上架</option>
                                                <option value="1">下架</option>
                                            </select>                                        </td>
                                    </tr>
                                     <tr bgcolor="#F2F2F2">    
                                        <td bgcolor="#F2F2F2" class="left_txt2" align="right">热卖:</td>
                                        <td bgcolor="#F2F2F2" class="left_txt2">
                                            <select id="selling" name="selling">
                                                <option value="0">否</option>
                                                <option value="1">是</option>
                                            </select>
                                            <span class="left_txt2">(首页)</span></td>
                                        <td bgcolor="#F2F2F2" class="left_txt2" align="right">数量:</td>
                                       <td bgcolor="#F2F2F2" class="left_txt2" colspan="3" >
                                        <input id="numberOf" name="numberOf" size="5" style="display:none;"/>
                                        <span class="STYLE1">秒杀时专用(其他商品不使用)</span></td>
                                    </tr>
                                    <tr bgcolor="#F2F2F2">  
                                        <td align="right" class="left_txt2">描述:</td>
                                        <td class="left_txt2" colspan="3"><textarea id="describeGoods" name="describeGoods" cols="100" rows="10"></textarea></td>
                                    </tr>
                                    <tr bgcolor="#F2F2F2">
                                        <td align="right" class="left_txt2">介绍:</td>
                                        <td class="left_txt2" colspan="3">
                                        <textarea name="introduceGoods" id="introduceGoods"></textarea>
                                        <script type="text/javascript">
                                        var um = UM.getEditor('introduceGoods',{
                                            //这里可以选择自己需要的工具按钮名称
                                            toolbar: ['undo redo | bold italic underline strikethrough | forecolor | removeformat |',
                                            'insertorderedlist insertunorderedlist | selectall cleardoc | paragraph fontsize',
                                            '| justifyleft justifycenter justifyright justifyjustify |',
                                            'link unlink | image | horizontal fullscreen'],
                                            //focus时自动清空初始化时的内容
                                            autoClearinitialContent: false,
                                            //关闭字数统计
                                            wordCount: false,
                                            //关闭elementPath
                                            elementPathEnabled: false,
                                            //默认的编辑区域高度
                                            initialFrameHeight: 240,
                                            //宽度 
                                            initialFrameWidth: 750,
                                            //自适应高度
                                            autoHeightEnabled: false,
                                            //工具条保持不动
                                            autoFloatEnabled: false,
                                            zIndex: 1,
                                            //更多其他参数,请参考umeditor.config.js中的配置项
                                            filterRules: function () {
                                                return {
                                                    //$:{}表示不保留任何属性
                                                    p: { $: {} },
                                                    h3: { $: {} },
                                                    h2: { $: {} },
                                                    img: function (node) {
                                                        var src = node.getAttr('src');
                                                        node.setAttr();
                                                        node.setAttr({ 'src': src })
                                                    },
                                                    //黑名单,以下标签及其子节点都会被过滤掉
                                                    '-': 'script style meta iframe embed object'
                                                }
                                            } ()
                                        });
                                        </script>                                        </td>
                                    </tr>
                                    <tr bgcolor="#F2F2F2">
                                        <td colspan="4" align="center" class="left_txt">
                                            <input type="submit" value="创建" />
                                            <input type="reset"value="重置"  />                                        </td>
                                    </tr>
                                </table>
                            </form>
                        </td>
                    </tr>
                </table>
                <!---->
            </div>
        </td>
        <td background="images/mail_rightbg.gif">&nbsp;</td>
    </tr>
    <tr>
        <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
        <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
        <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
    </tr>
</table>
</body>
</html>


修改

<?php
require 'includes/common.inc.php';
session_start();
if ( !isset($_SESSION['adminName']) ) {
    _location('请先登录','login.php');
}
$_html1 = array();
if (isset($_GET['id']) ) {
    $_result1 = _query("SELECT * FROM tb_GoodsInfo WHERE id = '{$_GET['id']}'");
    $_rows1 = _fetch_array($_result1);
    $_html1['GoodType'] = $_rows1['GoodType'];
    $_html1['GoodsName'] = $_rows1['GoodsName'];
    $_html1['GoodsPic'] = $_rows1['GoodsPic'];
    $_html1['GoodsPic2'] = $_rows1['GoodsPic2'];
    $_html1['GoodsPic3'] = $_rows1['GoodsPic3'];
    $_html1['marketPrice'] = $_rows1['marketPrice'];
    $_html1['memberPrice'] = $_rows1['memberPrice'];
    $_html1['returnIntegral'] = $_rows1['returnIntegral'];
    $_html1['preferential'] = $_rows1['preferential'];
    $_html1['postagePrice'] = $_rows1['postagePrice'];
    $_html1['bigClassId'] = $_rows1['bigClassId'];
    $_html1['smallClassId'] = $_rows1['smallClassId'];
    $_html1['brand'] = $_rows1['brand'];
    $_html1['distributionArea'] = $_rows1['distributionArea'];
    $_html1['articleNumber'] = $_rows1['articleNumber'];
    $_html1['weight'] = $_rows1['weight'];
    $_html1['viewed'] = $_rows1['viewed'];
    $_html1['selling'] = $_rows1['selling'];
    $_html1['recommendedGoods'] = $_rows1['recommendedGoods'];
    $_html1['newGoods'] = $_rows1['newGoods'];
    $_html1['describeGoods'] = $_rows1['describeGoods'];
    $_html1['introduceGoods'] = $_rows1['introduceGoods'];
    $_html1['sort'] = $_rows1['sort'];
    $_html1['state'] = $_rows1['state'];
    $_html1['numberOf'] = $_rows1['numberOf'];
    _free_result($_result1);
    $_html1 = _html($_html1);
}
//修改商品信息    
if ( isset($_GET['id']) && $_GET['action'] == 'update' ){
    $GoodType = _check($_POST['GoodType']);
    $GoodsName = _check($_POST['GoodsName']);
    $GoodsPic="";
    if(_check($_POST['GoodsPic'])==""){
        $GoodsPic=_check($_POST['oldGoodsPic']);
    }else{
        $GoodsPic=_check($_POST['GoodsPic']);
        unlink("../".$_POST['oldGoodsPic']."");
    }
    $GoodsPic2="";
    if(_check($_POST['GoodsPic2'])==""){
        $GoodsPic2=_check($_POST['oldGoodsPic2']);
    }else{
        $GoodsPic2=_check($_POST['GoodsPic2']);
        unlink("../".$_POST['oldGoodsPic2']."");
    }
    $GoodsPic3="";
    if(_check($_POST['GoodsPic3'])==""){
        $GoodsPic3=_check($_POST['oldGoodsPic3']);
    }else{
        $GoodsPic3=_check($_POST['GoodsPic3']);
        unlink("../".$_POST['oldGoodsPic3']."");
    }
    $marketPrice = _check($_POST['marketPrice']);
    $memberPrice = _check($_POST['memberPrice']);
    $returnIntegral = _check($_POST['returnIntegral']);
    $preferential = _check($_POST['preferential']);
    $postagePrice = _check($_POST['postagePrice']);
    $bigClassId=_check($_POST['bigClassId']);
    $smallClassId=_check($_POST['smallClassId']);
    $brand = _check($_POST['brand']);
    $distributionArea = _check($_POST['distributionArea']);
    $articleNumber = _check($_POST['articleNumber']);
    $weight = _check($_POST['weight']);
    $selling = _check($_POST['selling']);
    $recommendedGoods = _check($_POST['recommendedGoods']);
    $newGoods = _check($_POST['newGoods']);
    $describeGoods = _check($_POST['describeGoods']);
    $introduceGoods = _check($_POST['introduceGoods']);
    $sort = _check($_POST['sort']);
    $state = _check($_POST['state']);        
    $numberOf = _check($_POST['numberOf']);    
    $_sql = "UPDATE 
                   tb_GoodsInfo
                SET 
                GoodType = '$GoodType',
                GoodsName = '$GoodsName',
                GoodsPic = '$GoodsPic',
                GoodsPic2 = '$GoodsPic2',
                GoodsPic3 = '$GoodsPic3',
                marketPrice = '$marketPrice',
                memberPrice = '$memberPrice',
                returnIntegral = '$returnIntegral',
                preferential = '$preferential',
                postagePrice = '$postagePrice',
                bigClassId = '$bigClassId',
                smallClassId = '$smallClassId',
                brand = '$brand',
                distributionArea = '$distributionArea',
                articleNumber = '$articleNumber',
                weight = '$weight',
                selling = '$selling',
                recommendedGoods = '$recommendedGoods',
                newGoods = '$newGoods',
                describeGoods = '$describeGoods',
                introduceGoods = '$introduceGoods',
                state = '$state',
                numberOf = '$numberOf',
                sort = '$sort',
                state = '$state' WHERE id = '{$_GET['id']}'";
    _query($_sql);
                                    
    if ( _affected_rows() == 1 ) {
        _close();
        _alert_back('修改成功!');
    } else {
        _close();
        _alert_back('修改失败!');
    }
}


?>
<!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" />
<title>修改商品</title>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
<link href="../umeditor-utf8-php/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="../umeditor-utf8-php/third-party/jquery.min.js"></script>
<script type="text/javascript" src="../umeditor-utf8-php/umeditor.config.js" charset="utf-8"></script>
<script type="text/javascript" src="../umeditor-utf8-php/umeditor.min.js" charset="utf-8"></script>
<script type="text/javascript" src="../umeditor-utf8-php/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
//商品小类 数据保存到数组
var smallClass = new Array();
<?php
$rs = _query("select * from tb_category where grade = 2 and state=0 order by sort asc");
$counts = 0;
while( $row = _fetch_array($rs) ){
?>
smallClass[<?php echo $counts ?>] = new Array('<?php echo $row["categoryId"]?>','<?php echo $row["id"]?>','<?php echo $row["categoryName"]?>')
<?php
$counts = $counts + 1;
}
_free_result($rs);
?>
//商品品牌
var brandArray = new Array();
<?php
$rs = _query("select * from tb_category where grade = 3 and state=0 order by sort asc");
$counts = 0;
while( $row = _fetch_array($rs) ){
?>
brandArray[<?php echo $counts ?>] = new Array('<?php echo $row["categoryId"]?>','<?php echo $row["id"]?>','<?php echo $row["categoryName"]?>')
<?php
$counts = $counts + 1;
}
_free_result($rs);
?>
//商品可配送区域
var distributionAreaArray = new Array();
<?php
$rs = _query("select * from tb_category where grade = 4 and state=0 order by sort asc");
$counts = 0;
while( $row = _fetch_array($rs) ){
?>
distributionAreaArray[<?php echo $counts ?>] = new Array('<?php echo $row["categoryId"]?>','<?php echo $row["id"]?>','<?php echo $row["categoryName"]?>')
<?php
$counts = $counts + 1;
}
_free_result($rs);
?>
//商品属性分类
var attributeClassArray = new Array();
<?php
$rs = _query("select * from tb_category where grade = 5 and state=0 order by sort asc");
$counts = 0;
while( $row = _fetch_array($rs) ){
?>
attributeClassArray[<?php echo $counts ?>] = new Array('<?php echo $row["categoryId"]?>','<?php echo $row["id"]?>','<?php echo $row["categoryName"]?>')
<?php
$counts = $counts + 1;
}
_free_result($rs);
?>
//商品原产地
var countryOfOriginArray = new Array();
<?php
$rs = _query("select * from tb_category where grade = 6 and state=0 order by sort asc");
$counts = 0;
while( $row = _fetch_array($rs) ){
?>
countryOfOriginArray[<?php echo $counts ?>] = new Array('<?php echo $row["categoryId"]?>','<?php echo $row["id"]?>','<?php echo $row["categoryName"]?>')
<?php
$counts = $counts + 1;
}
_free_result($rs);
?>
//商品适应人群
var adaptCrowdArray = new Array();
<?php
$rs = _query("select * from tb_category where grade = 7 and state=0 order by sort asc");
$counts = 0;
while( $row = _fetch_array($rs) ){
?>
adaptCrowdArray[<?php echo $counts ?>] = new Array('<?php echo $row["categoryId"]?>','<?php echo $row["id"]?>','<?php echo $row["categoryName"]?>')
<?php
$counts = $counts + 1;
}
_free_result($rs);
?>
//商品功效
var productEfficacyArray = new Array();
<?php
$rs = _query("select * from tb_category where grade = 8 and state=0 order by sort asc");
$counts = 0;
while( $row = _fetch_array($rs) ){
?>
productEfficacyArray[<?php echo $counts ?>] = new Array('<?php echo $row["categoryId"]?>','<?php echo $row["id"]?>','<?php echo $row["categoryName"]?>')
<?php
$counts = $counts + 1;
}
_free_result($rs);
?>

//商品保质期
var shelfLifeArray = new Array();
<?php
$rs = _query("select * from tb_category where grade = 9 and state=0 order by sort asc");
$counts = 0;
while( $row = _fetch_array($rs) ){
?>
shelfLifeArray[<?php echo $counts ?>] = new Array('<?php echo $row["categoryId"]?>','<?php echo $row["id"]?>','<?php echo $row["categoryName"]?>')
<?php
$counts = $counts + 1;
}
_free_result($rs);
?>

//商品储存
var storagesArray = new Array();
<?php
$rs = _query("select * from tb_category where grade = 10 and state=0 order by sort asc");
$counts = 0;
while( $row = _fetch_array($rs) ){
?>
storagesArray[<?php echo $counts ?>] = new Array('<?php echo $row["categoryId"]?>','<?php echo $row["id"]?>','<?php echo $row["categoryName"]?>')
<?php
$counts = $counts + 1;
}
_free_result($rs);
?>

function getBigClass(locationid) {
    
    document.addGoodsForm.smallClassId.length = 0;
    document.addGoodsForm.smallClassId.options[0] = new Option('请选择商品小类','0');
    for ( i=0; i<smallClass.length; i++ ) {
        if( smallClass[i][0] == locationid ) {
            document.addGoodsForm.smallClassId.options[document.addGoodsForm.smallClassId.length] = new Option(smallClass[i][2],smallClass[i][1]);
        }
    }
    
    document.addGoodsForm.brand.length = 0;
    document.addGoodsForm.brand.options[0] = new Option('请选择商品品牌','0');
    for ( i=0; i<brandArray.length; i++ ) {
        if( brandArray[i][0] == locationid ) {
            document.addGoodsForm.brand.options[document.addGoodsForm.brand.length] = new Option(brandArray[i][2],brandArray[i][1]);
        }
    }
    
    /*document.addGoodsForm.distributionArea.length = 0;
    document.addGoodsForm.distributionArea.options[0] = new Option('请选择商品可配送区域','0');
    for ( i=0; i<distributionAreaArray.length; i++ ) {
        if( distributionAreaArray[i][0] == locationid ) {
            document.addGoodsForm.distributionArea.options[document.addGoodsForm.distributionArea.length] = new Option(distributionAreaArray[i][2],distributionAreaArray[i][1]);
        }
    }
    
    document.addGoodsForm.attributeClass.length = 0;
    document.addGoodsForm.attributeClass.options[0] = new Option('请选择商品属性分类','0');
    for ( i=0; i<attributeClassArray.length; i++ ) {
        if( attributeClassArray[i][0] == locationid ) {
            document.addGoodsForm.attributeClass.options[document.addGoodsForm.attributeClass.length] = new Option(attributeClassArray[i][2],attributeClassArray[i][1]);
        }
    }
    
    document.addGoodsForm.countryOfOrigin.length = 0;
    document.addGoodsForm.countryOfOrigin.options[0] = new Option('请选择商品原产地','0');
    for ( i=0; i<countryOfOriginArray.length; i++ ) {
        if( countryOfOriginArray[i][0] == locationid ) {
            document.addGoodsForm.countryOfOrigin.options[document.addGoodsForm.countryOfOrigin.length] = new Option(countryOfOriginArray[i][2],countryOfOriginArray[i][1]);
        }
    }
    
    document.addGoodsForm.adaptCrowd.length = 0;
    document.addGoodsForm.adaptCrowd.options[0] = new Option('请选择商品适应人群','0');
    for ( i=0; i<adaptCrowdArray.length; i++ ) {
        if( adaptCrowdArray[i][0] == locationid ) {
            document.addGoodsForm.adaptCrowd.options[document.addGoodsForm.adaptCrowd.length] = new Option(adaptCrowdArray[i][2],adaptCrowdArray[i][1]);
        }
    }
    
    document.addGoodsForm.productEfficacy.length = 0;
    document.addGoodsForm.productEfficacy.options[0] = new Option('请选择商品功效','0');
    for ( i=0; i<productEfficacyArray.length; i++ ) {
        if( productEfficacyArray[i][0] == locationid ) {
            document.addGoodsForm.productEfficacy.options[document.addGoodsForm.productEfficacy.length] = new Option(productEfficacyArray[i][2],productEfficacyArray[i][1]);
        }
    }
    
    document.addGoodsForm.shelfLife.length = 0;
    document.addGoodsForm.shelfLife.options[0] = new Option('请选择商品保质期','0');
    for ( i=0; i<shelfLifeArray.length; i++ ) {
        if( shelfLifeArray[i][0] == locationid ) {
            document.addGoodsForm.shelfLife.options[document.addGoodsForm.shelfLife.length]=new Option(shelfLifeArray[i][2],shelfLifeArray[i][1]);
        }
    }
    
    document.addGoodsForm.storages.length = 0;
    document.addGoodsForm.storages.options[0] = new Option('请选择商品储存','0');
    for ( i=0; i<storagesArray.length; i++ ) {
        if( storagesArray[i][0] == locationid ) {
            document.addGoodsForm.storages.options[document.addGoodsForm.storages.length]=new Option(storagesArray[i][2],storagesArray[i][1]);
        }
    }*/
}
</script>
<script language="javascript">
function $(obj){return document.getElementById(obj);}
function show(objid) {$(objid).style.display='inline';}
function hidden(objid) {$(objid).style.display='none';}
function doit(){
var sel_val=$('GoodType').value;
    if (sel_val=='') {hidden('numberOf');}
    if (sel_val==1) {hidden('numberOf');}
    if (sel_val==2) {hidden('numberOf');}
    if (sel_val==3) {hidden('numberOf');}
    if (sel_val==4) {hidden('numberOf');}
    if (sel_val==5) {show('numberOf');}
    if (sel_val==6) {show('numberOf');}
    if (sel_val==7) {hidden('numberOf');}
}
</script>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
        <td valign="top" background="images/content-bg.gif">
            <table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
                <tr>
                    <td height="31">
                        <div class="titlebt">修改商品</div>
                    </td>
                </tr>
            </table>
        </td>
        <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
    </tr>
    <tr>
        <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
        <td valign="top" bgcolor="#F7F8F9">
            <div>
                <!---->
                <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                        <td height="10"></td>
                    </tr>
                    <tr>
                        <td>
                            <form  method="post" action="?action=update&id=<?php echo $_GET['id'] ?>" name="addGoodsForm" id="addGoodsForm">
                                   <table cellpadding="0" cellspacing="0" class="nowtable">
                                    <tr bgcolor="#F2F2F2">
                                        <td class="left_txt2" align="right">商品类型:</td>
                                        <td class="left_txt2">
                                        <select id="GoodType" name="GoodType"  οnchange="javascript:doit();">
                                            <option value="1" <?php if($_html1["GoodType"]==1){echo "selected='selectd'";}?>>普通商品</option>
                                            <option value="2" <?php if($_html1["GoodType"]==2){echo "selected='selectd'";}?>>抢特惠</option>
                                            <option value="3" <?php if($_html1["GoodType"]==3){echo "selected='selectd'";}?>>企业采购</option>
                                            <option value="4" <?php if($_html1["GoodType"]==4){echo "selected='selectd'";}?>>批发商品</option>
                                            <option value="5" <?php if($_html1["GoodType"]==5){echo "selected='selectd'";}?>>秒杀商品</option>
                                            <option value="6" <?php if($_html1["GoodType"]==6){echo "selected='selectd'";}?>>秒杀下期预告商品</option>
                                            <option value="7" <?php if($_html1["GoodType"]==7){echo "selected='selectd'";}?>>充值有礼实物礼品</option>
                                        </select>                                        </td>
                                        <td class="left_txt2" align="right">商品名称:</td>
                                        <td class="left_txt2">
                                        <input type="text" name="GoodsName" id="GoodsName" value="<?php echo $_html1['GoodsName']?>"/>                                        </td> 
                                    </tr>
                                    <tr bgcolor="#F2F2F2">
                                         <td class="left_txt2" align="right">商品图片:</td>
                                         <td class="left_txt2">
                                        <input type="hidden" name="oldGoodsPic" id="oldGoodsPic" value="<?php echo $_html1['GoodsPic']?>"/>
                                        大图:<input type="text" name="GoodsPic" id="GoodsPic"/>
                                        <input type="button" value="上传" onClick="window.open('upload.php?formname=addGoodsForm&editname= GoodsPic&imageUrl=images/GoodsImages/','','status=no,scrollbars=no,top=35,width=650,height=350')"/>
                                        注:为空则不修改<br />
                                        <input type="hidden" name="oldGoodsPic2" id="oldGoodsPic2" value="<?php echo $_html1['GoodsPic2']?>"/>
                                        小图:<input type="text" name="GoodsPic2" id="GoodsPic2"/>
                                        <input type="button" value="上传" onClick="window.open('upload.php?formname=addGoodsForm&editname= GoodsPic2&imageUrl=images/GoodsImages/','','status=no,scrollbars=no,top=35,width=650,height=350')"/>
                                        注:为空则不修改<br />
                                        <input type="hidden" name="oldGoodsPic3" id="oldGoodsPic3" value="<?php echo $_html1['GoodsPic3']?>"/>
                                        手机:<input type="text" name="GoodsPic3" id="GoodsPic3"/>
                                        <input type="button" value="上传" onClick="window.open('upload.php?formname=addGoodsForm&editname= GoodsPic3&imageUrl=images/GoodsImages/','','status=no,scrollbars=no,top=35,width=650,height=350')"/>
                                        注:为空则不修改                                        </td>
                                         <td class="left_txt2" align="right">商品市场价:</td>
                                        <td class="left_txt2">
                                         <input name="marketPrice" type="text" id="marketPrice" value="<?php echo $_html1['marketPrice']?>"/>                                        </td>
                                    </tr>
                                    <tr bgcolor="#F2F2F2">
                                        <td class="left_txt2" align="right">会员价/批发价/企业采购价:</td>
                                        <td class="left_txt2">
                                         <input name="memberPrice" type="text" id="memberPrice" value="<?php echo $_html1['memberPrice']?>"/>                                        </td>
                                        <td class="left_txt2" align="right">返还积分数:</td>
                                        <td class="left_txt2">
                                        <input name="returnIntegral" type="text" id="returnIntegral" value="<?php echo $_html1['returnIntegral']?>"/>                                        </td>
                                    </tr>
                                    <tr bgcolor="#F2F2F2">
                                        <td class="left_txt2" align="right">优惠积分:</td>
                                        <td class="left_txt2">
                                        <input name="preferential" type="text" id="preferential" value="<?php echo $_html1['preferential']?>"/>
                                        仅限积分专区商品使用                                        </td>
                                        <td class="left_txt2" align="right">邮费:</td>
                                        <td class="left_txt2">
                                            <input name="postagePrice" type="text" id="postagePrice" value="<?php echo $_html1['postagePrice']?>"/>                                        </td>
                                    </tr>
                                    <tr bgcolor="#F2F2F2">
                                        <td class="left_txt2" align="right">商品大类:</td>
                                        <td class="left_txt2">
                                        <select name="bigClassId" id="bigClassId" οnchange="getBigClass(this.value)">
                                            <option value="0">请选择商品大类</option>
                                            <?php
                                            $rs = _query("SELECT * FROM tb_category WHERE grade = 1 AND state = 0 order by sort asc");
                                                while( $row = _fetch_array($rs) ){    
                                            ?>
                                            <option value="<?php echo $row['id']?>" <?php if($_html1['bigClassId']==$row['id']){echo "selected='selected'";} ?>><?php echo $row['categoryName'] ?></option>
                                            <?php
                                                }
                                            _free_result($rs);
                                            ?>
                                        </select>                                        
                                        </td>
                                        <td class="left_txt2" align="right">商品小类:</td>
                                        <td class="left_txt2">
                                        <select name="smallClassId" id="smallClassId" >
                                            <option value="0">请选择商品小类</option>
                                            <?php
                                            $rs = _query("select * from tb_category where grade = 2 and state=0 and categoryId = '{$_html1['bigClassId']}' order by sort asc");
                                                while( $row = _fetch_array($rs) ){    
                                            ?>
                                            <option value="<?php echo $row['id']?>" <?php if($_html1['smallClassId']==$row['id']){echo "selected='selected'";} ?>><?php echo $row['categoryName'] ?></option>
                                            <?php
                                                }
                                            _free_result($rs);
                                            ?>
                                        </select>                                        </td>
                                    </tr>
                                    <tr bgcolor="#F2F2F2">
                                        <td class="left_txt2" align="right">商品品牌:</td>
                                        <td class="left_txt2">
                                        <select name="brand" id="brand" >
                                            <option value="0">请选择商品品牌</option>
                                            <?php
                                            $rs = _query("select * from tb_category where grade = 3 and state=0 order by sort asc");
                                                while( $row = _fetch_array($rs) ){    
                                            ?>
                                            <option value="<?php echo $row['id']?>" <?php if($row['id']==$_html1['brand']){echo "selected='selected'";} ?>><?php echo $row['categoryName'] ?></option>
                                            <?php
                                                }
                                            _free_result($rs);
                                            ?>
                                        </select>                                        </td>
                                        <td class="left_txt2" align="right">商品可配送区域:</td>
                                        <td class="left_txt2">
                                        <select name="distributionArea" id="distributionArea" >
                                            <option value="0">请选择商品可配送区域</option>
                                            <?php
                                            $rs = _query("select * from tb_area where areaType = 2 and state = 0 order by sort asc");
                                                while( $row = _fetch_array($rs) ){    
                                            ?>
                                            <option value="<?php echo $row['id']?>" <?php if($row['id']==$_html1['distributionArea']){echo "selected='selected'";} ?>><?php echo $row['areaName'] ?></option>
                                            <?php
                                                }
                                            _free_result($rs);
                                            ?>
                                        </select>                                        </td>
                                    </tr>
                                    <tr bgcolor="#F2F2F2">    
                                        <td class="left_txt2" align="right">货号:</td>
                                        <td class="left_txt2">
                                            <input name="articleNumber" type="text" id="articleNumber" value="<?php echo $_html1["articleNumber"]?>"/>                                        </td>
                                        <td class="left_txt2" align="right">重量:</td>
                                        <td class="left_txt2">
                                            <input name="weight" type="text" id="weight" value="<?php echo $_html1["weight"]?>"/>                                        </td>
                                    </tr>
                                    <tr bgcolor="#F2F2F2">  
                                        <td class="left_txt2" align="right">推荐:</td>
                                        <td class="left_txt2">
                                        <select id="recommendedGoods" name="recommendedGoods">
                                            <option value="0" <?php if($_html1['recommendedGoods']==0){echo "selected='selected'";} ?>>否</option>
                                            <option value="1" <?php if($_html1['recommendedGoods']==1){echo "selected='selected'";} ?>>是</option>
                                        </select>
                                            <span class="left_txt2">(首页和侧边的猜你喜欢)</span>                                        </td>
                                        <td align="right" class="left_txt2">最新:</td>
                                        <td class="left_txt2">
                                        <select id="newGoods" name="newGoods">
                                            <option value="0" <?php if($_html1['newGoods']==0){echo "selected='selected'";} ?>>否</option>
                                            <option value="1" <?php if($_html1['newGoods']==1){echo "selected='selected'";} ?>>是</option>
                                        </select>
                                        <span class="left_txt2"> (首页)</span>                                        </td>
                                    </tr>
                                    
                                    <tr bgcolor="#F2F2F2">  
                                        <td class="left_txt2" align="right">排序:</td>
                                        <td class="left_txt2">
                                            <input type="text" name="sort" id="sort" value="<?php echo $_html1['sort']?>"/>                                        </td>
                                        <td align="right" class="left_txt2">状态:</td>
                                        <td class="left_txt2">
                                            <select id="state" name="state">
                                                <option value="0" <?php if($_html1['state']==0){echo "selected='selected'";} ?>>上架</option>
                                                <option value="1" <?php if($_html1['state']==1){echo "selected='selected'";} ?>>下架</option>
                                            </select>                                        </td>
                                    </tr>
                                     <tr bgcolor="#F2F2F2">    
                                        <td bgcolor="#F2F2F2" class="left_txt2" align="right">热卖:</td>
                                        <td bgcolor="#F2F2F2" class="left_txt2">
                                            <select id="selling" name="selling">
                                                <option value="0" <?php if($_html1['selling']==0){echo "selected='selected'";} ?>>否</option>
                                                <option value="1" <?php if($_html1['selling']==1){echo "selected='selected'";} ?>>是</option>
                                            </select>
                                            <span class="left_txt2">(首页)</span></td>
                                        <td bgcolor="#F2F2F2" class="left_txt2" align="right">数量:</td>
                                        <td bgcolor="#F2F2F2" class="left_txt2" colspan="3" >
                                        <input id="numberOf" name="numberOf" size="5" value="<?php echo $_html1["numberOf"]?>"/>
                                        <span class="STYLE1" style="color:#FF0000">秒杀时专用(其他商品不使用)</span></td>
                                    </tr>
                                    <tr bgcolor="#F2F2F2">  
                                        <td align="right" class="left_txt2">描述:</td>
                                        <td class="left_txt2" colspan="3">
                                            <textarea id="describeGoods" name="describeGoods" cols="100" rows="10"><?php echo $_html1['describeGoods']?></textarea>                                        </td>
                                    </tr>
                                    <tr bgcolor="#F2F2F2">
                                        <td align="right" class="left_txt2">介绍:</td>
                                        <td class="left_txt2" colspan="3">
                                        <textarea name="introduceGoods" id="introduceGoods"><?php echo $_html1['introduceGoods']?></textarea>
                                        <script type="text/javascript">
                                        var um = UM.getEditor('introduceGoods',{
                                            //这里可以选择自己需要的工具按钮名称
                                            toolbar: ['undo redo | bold italic underline strikethrough | forecolor | removeformat |',
                                            'insertorderedlist insertunorderedlist | selectall cleardoc | paragraph fontsize',
                                            '| justifyleft justifycenter justifyright justifyjustify |',
                                            'link unlink | image | horizontal fullscreen'],
                                            //focus时自动清空初始化时的内容
                                            autoClearinitialContent: false,
                                            //关闭字数统计
                                            wordCount: false,
                                            //关闭elementPath
                                            elementPathEnabled: false,
                                            //默认的编辑区域高度
                                            initialFrameHeight: 240,
                                            //宽度 
                                            initialFrameWidth: 750,
                                            //自适应高度
                                            autoHeightEnabled: false,
                                            //工具条保持不动
                                            autoFloatEnabled: false,
                                            zIndex: 1,
                                            //更多其他参数,请参考umeditor.config.js中的配置项
                                            filterRules: function () {
                                                return {
                                                    //$:{}表示不保留任何属性
                                                    p: { $: {} },
                                                    h3: { $: {} },
                                                    h2: { $: {} },
                                                    img: function (node) {
                                                        var src = node.getAttr('src');
                                                        node.setAttr();
                                                        node.setAttr({ 'src': src })
                                                    },
                                                    //黑名单,以下标签及其子节点都会被过滤掉
                                                    '-': 'script style meta iframe embed object'
                                                }
                                            } ()
                                        });
                                        </script>                                        </td>
                                    </tr>
                                    <tr bgcolor="#F2F2F2">
                                        <td colspan="4" align="center" class="left_txt">
                                            <input type="submit" value="确认修改" />                                        </td>
                                    </tr>
                                </table>
                          </form>
                        </td>
                    </tr>
                </table>
                <!---->
            </div>
        </td>
        <td background="images/mail_rightbg.gif">&nbsp;</td>
    </tr>
    <tr>
        <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
        <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
        <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
    </tr>
</table>
</body>
</html>
View Code

 

 查询   省市区

<?php

    require 'includes/common.inc.php';
    
    session_start();
    
    if ( !isset($_SESSION['adminName']) ) {
        _location('请先登录','login.php');
    }
    if ( isset($_GET['id']) ) {
        $_sql = "SELECT * FROM tb_user WHERE id = '{$_GET['id']}'";
        $_result = _query($_sql);
        $_rows = _fetch_array($_result);
        $_html = array();
        $_html['userName'] = $_rows['userName'];
        $_html['userEmail'] = $_rows['userEmail'];
        $_html['userPwd'] = $_rows['userPwd'];
        $_html['tradingPwd'] = $_rows['tradingPwd'];
        $_html['encryptedQuestion'] = $_rows['encryptedQuestion'];
        $_html['encryptedAnswer'] = $_rows['encryptedAnswer'];
        $_html['realName'] = $_rows['realName'];
        $_html['province'] = $_rows['province'];
        $_html['theCity'] = $_rows['theCity'];
        $_html['county'] = $_rows['county'];
        $_html['address'] = $_rows['address'];
        $_html['qq'] = $_rows['qq'];
        $_html['phone'] = $_rows['phone'];
        $_html['integral'] = $_rows['integral'];
        $_html['cash'] = $_rows['cash'];
        $_html['state'] = $_rows['state'];
        $_html['identity'] = $_rows['identity'];
        $_sqlProvince = "SELECT areaName FROM tb_area WHERE id = '{$_html['province']}'";
        $_resultProvince = _query($_sqlProvince);
        $_rowsProvince = _fetch_array($_resultProvince);
        
        $_sqlCity = "SELECT areaName FROM tb_area WHERE id = '{$_html['theCity']}'";
        $_resultCity = _query($_sqlCity);
        $_rowsCity = _fetch_array($_resultCity);
        
        $_sqlCounty = "SELECT areaName FROM tb_area WHERE id = '{$_html['county']}'";
        $_resultCounty = _query($_sqlCounty);
        $_rowsCounty = _fetch_array($_resultCounty);
        $_html = _html($_html);    
        }
    if ( isset($_GET['id']) && $_GET['action'] == 'update' ){
        $_clean = array();
        $_clean['userPwd'] = md5(_check($_POST['userPwd']));
        $_clean['tradingPwd'] = md5(_check($_POST['tradingPwd']));
        $_clean['encryptedQuestion'] = _check($_POST['encryptedQuestion']);
        $_clean['encryptedAnswer'] = _check($_POST['encryptedAnswer']);
        $_clean['state'] = _check($_POST['state']);
        $_clean['identity'] = _check($_POST['identity']);
        $_sql = "UPDATE 
                       tb_user
                    SET 
                      userPwd = '{$_clean['userPwd']}',
                      tradingPwd = '{$_clean['tradingPwd']}',
                      encryptedQuestion = '{$_clean['encryptedQuestion']}',
                      encryptedAnswer = '{$_clean['encryptedAnswer']}',
                      state = '{$_clean['state']}',
                      identity = '{$_clean['identity']}'
                  WHERE 
                         id = '{$_GET['id']}'";
        _query($_sql);
        if ( _affected_rows() == 1 ) {
            _close();
            _location('修改成功!','user.php');
        } else {
            _close();
            _alert_back('修改失败!');
        }
    }
?>
<!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" />
<title>后台管理--修改会员信息</title>
<style type="text/css">
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    background-color: #F8F9FA;
}
-->
</style>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
    <td  valign="top" background="images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
        <tr>
          <td height="31"><div class="titlebt">会员管理</div></td>
        </tr>
      </table></td>
    <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
  </tr>
  <tr>
    <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9"><div>
        <!---->
        <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td class="left_txt" >当前位置:修改会员</td>
          </tr>
          <tr>
            <td><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="nowtable">
               <form name="admin" id="admin" method="POST" action="?action=update&id=<?php echo $_GET['id']?>">
                  <tr class="left_txt2" align="right">
                    <td width="26%" class="left_txt2" bgcolor="#F2F2F2">账号名称:</td>
                    <td width="27%" class="left_txt2" bgcolor="#F2F2F2" align="left"><?php echo $_html['userName'] ?></td>
                    <td width="8%" class="left_txt2" bgcolor="#F2F2F2">省:</td>
                    <td width="39%" align="left" class="left_txt2" bgcolor="#F2F2F2"><?php echo $_rowsProvince['areaName']?></td>
                  </tr>
                  <tr class="left_txt2" align="right" >
                    <td class="left_txt2" bgcolor="#F2F2F2">真实名称:</td>
                    <td class="left_txt2" align="left" bgcolor="#F2F2F2"><?php echo $_html['realName'] ?></td>
                    <td class="left_txt2" bgcolor="#F2F2F2">市:</td>
                    <td align="left" class="left_txt2" bgcolor="#F2F2F2"><?php echo $_rowsCity['areaName']?></td>
                  </tr>
                  <tr align="right">
                    <td class="left_txt2" bgcolor="#F2F2F2">会员密码:</td>
                    <td class="left_txt2" bgcolor="#F2F2F2" align="left"><input type="password" name="userPwd"  id="userPwd"  size="31" value="<?php echo $_html['userPwd'] ?>"/></td>
                    <td class="left_txt2" bgcolor="#F2F2F2">县:</td>
                    <td class="left_txt2" bgcolor="#F2F2F2" align="left"><?php echo $_rowsCounty['areaName']?></td>
                  </tr>
                  <tr align="right">
                    <td class="left_txt2" bgcolor="#F2F2F2">交易密码:</td>
                    <td class="left_txt2" bgcolor="#F2F2F2" align="left"><input type="password" name="tradingPwd" id="tradingPwd"  size="31" value="<?php echo $_html['tradingPwd'] ?>" /></td>
                    <td class="left_txt2" bgcolor="#F2F2F2">详细地址:</td>
                    <td class="left_txt2" bgcolor="#F2F2F2" align="left"><?php echo $_html['address'] ?></td>
                  </tr>
                  <tr class="left_txt2" align="right">
                    <td class="left_txt2" bgcolor="#F2F2F2">账号邮箱:</td>
                    <td class="left_txt2" bgcolor="#F2F2F2" align="left"><?php echo $_html['userEmail'] ?></td>
                    <td class="left_txt2" bgcolor="#F2F2F2">QQ:</td>
                    <td class="left_txt2" bgcolor="#F2F2F2" align="left"><?php echo $_html['qq'] ?></td>
                  </tr>
                  <tr align="right">
                    <td class="left_txt2" bgcolor="#F2F2F2">密码问题:</td>
                    <td class="left_txt2" bgcolor="#F2F2F2" align="left"><input type="text" name="encryptedQuestion"  id="encryptedQuestion" size="30" value="<?php echo $_html['encryptedQuestion'] ?>"/></td>
                    <td class="left_txt2" bgcolor="#F2F2F2">电话:</td>
                    <td class="left_txt2" bgcolor="#F2F2F2" align="left"><?php echo $_html['phone'] ?></td>
                  </tr>
                  <tr class="left_txt2" align="right">
                    <td class="left_txt2" bgcolor="#F2F2F2">密保答案:</td>
                    <td class="left_txt2" bgcolor="#F2F2F2" align="left"><input type="text" name="encryptedAnswer"  id="encryptedAnswer"  size="30" value="<?php echo $_html['encryptedAnswer'] ?>"/></td>
                    <td class="left_txt2" bgcolor="#F2F2F2">积分:</td>
                    <td class="left_txt2" bgcolor="#F2F2F2" align="left"><?php echo $_html['integral'] ?></td>
                  </tr>
                  <tr align="right">
                    <td class="left_txt2" bgcolor="#F2F2F2">现金:</td>
                    <td class="left_txt2" bgcolor="#F2F2F2" align="left"><?php echo $_html['cash'] ?></td>
                    <td class="left_txt2" bgcolor="#F2F2F2">状态:</td>
                    <td class="left_txt2" bgcolor="#F2F2F2" align="left">
                    <select id="state" name="state">
                        <option value="0" <?php if ($_html['state']==0) echo "selected" ?>>正常</option>
                        <option value="1" <?php if ($_html['state']==1) echo "selected" ?>>冻结</option>
                      </select></td>
                  </tr>
                  <tr>
                       <td class="left_txt2" bgcolor="#F2F2F2" align="right">会员类型:</td>
                      <td class="left_txt2" bgcolor="#F2F2F2" colspan="3">
                      <select id="identity" name="identity">
                            <option value="0" <?php if ($_html['identity']==0) echo "selected" ?>>普通会员</option>
                            <option value="1" <?php if ($_html['identity']==1) echo "selected" ?>>企业会员</option>
                        </select>
                    <td>
                 </tr>
                  <tr>
                    <td height="30" colspan="4" align="center" class="left_txt2" bgcolor="#F2F2F2"><input type="submit" name="button" id="button" value="修改"  />
                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                      <input type="reset" name="button2" id="button2" value="取消"  οnclick="history.go(-1);"/></td>
                  </tr>
                </form>
              </table>
          </tr>
        </table>
        <!---->
      </div></td>
    <td background="images/mail_rightbg.gif">&nbsp;</td>
  </tr>
  <tr>
    <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
    <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
    <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
  </tr>
</table>
</body>
</html>
View Code

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值