products.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. <?php
  2. require_once('conn.php');
  3. // Check login status (assuming you have a similar function in PHP)
  4. checkLogin("信息管理");
  5. // Initialize all variables to avoid undefined warnings
  6. $act = isset($_GET['act']) ? $_GET['act'] : '';
  7. $product_name = isset($_POST['ProductName']) ? htmlspecialcharsFix($_POST['ProductName']) : '';
  8. $product_img = isset($_POST['ProductImg']) ? htmlspecialcharsFix($_POST['ProductImg']) : '';
  9. $unit = isset($_POST['unit']) ? htmlspecialcharsFix($_POST['unit']) : '';
  10. $moq = isset($_POST['moq']) ? htmlspecialcharsFix($_POST['moq']) : '';
  11. $category_id = isset($_POST['category_id']) ? intval($_POST['category_id']) : (isset($_GET['category_id']) ? intval($_GET['category_id']) : 0);
  12. $nosale = isset($_POST['nosale']) ? $_POST['nosale'] : array();
  13. $num = isset($_POST['num']) ? $_POST['num'] : array();
  14. $price = isset($_POST['price']) ? $_POST['price'] : array();
  15. $note = isset($_POST['note']) ? htmlspecialcharsFix($_POST['note']) : '';
  16. $tips = isset($_POST['tips']) ? htmlspecialcharsFix($_POST['tips']) : '';
  17. $page = isset($_GET['Page']) ? $_GET['Page'] : 1;
  18. $keys = isset($_GET['Keys']) ? urlencode($_GET['Keys']) : '';
  19. $keyscode = isset($_GET['Keys']) ? htmlspecialcharsFix($_GET['Keys']) : '';
  20. // Handle form submissions and redirects before any output
  21. if ($act == 'save') {
  22. $id = isset($_POST['id']) ? $_POST['id'] : '';
  23. $is_edit = (!empty($id) && is_numeric($id));
  24. // Process nosale array into comma-separated string
  25. $nosale_str = '';
  26. if (is_array($nosale) && !empty($nosale)) {
  27. $nosale_clean = array_map('intval', $nosale); // Ensure all values are integers
  28. $nosale_str = implode(',', $nosale_clean);
  29. }
  30. if ($is_edit) {
  31. // Update existing product
  32. $sql = "UPDATE products SET
  33. ProductName = '" . mysqli_real_escape_string($conn, $product_name) . "',
  34. ProductImg = '" . mysqli_real_escape_string($conn, $product_img) . "',
  35. Addtime = NOW(),
  36. moq = '" . mysqli_real_escape_string($conn, $moq) . "',
  37. unit = '" . mysqli_real_escape_string($conn, $unit) . "',
  38. nosale = '" . $nosale_str . "',
  39. note = '" . mysqli_real_escape_string($conn, $note) . "',
  40. tips = '" . mysqli_real_escape_string($conn, $tips) . "',
  41. category_id = " . $category_id . "
  42. WHERE id = " . (int)$id;
  43. mysqli_query($conn, $sql);
  44. // Handle price updates
  45. mysqli_query($conn, "DELETE FROM price WHERE productId = " . (int)$id . " AND AreaId = 0");
  46. if (is_array($num) && is_array($price)) {
  47. foreach ($num as $key => $num_value) {
  48. if (isset($price[$key])) { // Only process if we have both num and price
  49. $num_value = empty($num_value) ? 0 : (float)$num_value;
  50. $price_value = empty($price[$key]) ? 0 : (float)$price[$key];
  51. $sql = "INSERT INTO price (productId, AreaId, num, price) VALUES
  52. (" . (int)$id . ", 0, " . $num_value . ", '" . $price_value . "')";
  53. mysqli_query($conn, $sql);
  54. }
  55. }
  56. }
  57. } else {
  58. // Insert new product
  59. $sql = "INSERT INTO products (ProductName, ProductImg, Addtime, moq, unit, nosale, note, tips, category_id)
  60. VALUES (
  61. '" . mysqli_real_escape_string($conn, $product_name) . "',
  62. '" . mysqli_real_escape_string($conn, $product_img) . "',
  63. NOW(),
  64. '" . mysqli_real_escape_string($conn, $moq) . "',
  65. '" . mysqli_real_escape_string($conn, $unit) . "',
  66. '" . $nosale_str . "',
  67. '" . mysqli_real_escape_string($conn, $note) . "',
  68. '" . mysqli_real_escape_string($conn, $tips) . "',
  69. " . $category_id . "
  70. )";
  71. mysqli_query($conn, $sql);
  72. $id = mysqli_insert_id($conn);
  73. // Handle price insertions
  74. if (is_array($num) && is_array($price)) {
  75. foreach ($num as $key => $num_value) {
  76. if (isset($price[$key])) { // Only process if we have both num and price
  77. $num_value = empty($num_value) ? 0 : (float)$num_value;
  78. $price_value = empty($price[$key]) ? 0 : (float)$price[$key];
  79. $sql = "INSERT INTO price (productId, AreaId, num, price) VALUES
  80. (" . (int)$id . ", 0, " . $num_value . ", '" . $price_value . "')";
  81. mysqli_query($conn, $sql);
  82. }
  83. }
  84. }
  85. }
  86. // Redirect after save
  87. header("Location: ?keys=" . $keys . "&Page=" . $page);
  88. exit();
  89. }
  90. // Handle bulk actions
  91. if ($act == 'postchk') {
  92. if (isset($_POST['chkbox']) && isset($_POST['chkact'])) {
  93. $chk_ids = array_map('intval', $_POST['chkbox']);
  94. $chk_act = (int)$_POST['chkact'];
  95. if (!empty($chk_ids)) {
  96. $ids_str = implode(',', $chk_ids);
  97. switch ($chk_act) {
  98. case 0:
  99. case 1:
  100. $sql = "UPDATE customer SET cs_state = " . $chk_act . " WHERE id IN (" . $ids_str . ")";
  101. break;
  102. case -1:
  103. $sql = "DELETE FROM products WHERE id IN (" . $ids_str . ")";
  104. break;
  105. }
  106. if (isset($sql)) {
  107. mysqli_query($conn, $sql);
  108. }
  109. }
  110. header("Location: ?Keys=" . $keys . "&Page=" . $page);
  111. exit();
  112. }
  113. }
  114. ?>
  115. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  116. <html xmlns="http://www.w3.org/1999/xhtml">
  117. <head>
  118. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  119. <title>产品信息管理</title>
  120. <link rel="stylesheet" href="css/common.css" type="text/css" />
  121. <script language="javascript" src="js/jquery-1.7.2.min.js"></script>
  122. <script type="text/javascript" src="js/js.js"></script>
  123. <script type="text/javascript" src="js/SearchArea.js"></script>
  124. <script type="text/javascript" src="xheditor-1.1.9/xheditor-1.1.9-zh-cn.min.js"></script>
  125. <style>
  126. .add_btn {
  127. background-color: #5cb85c;
  128. color: white;
  129. padding: 6px 15px;
  130. border: none;
  131. border-radius: 3px;
  132. cursor: pointer;
  133. font-weight: bold;
  134. }
  135. .add_btn:hover {
  136. background-color: #449d44;
  137. }
  138. .search_panel {
  139. padding: 15px;
  140. border-radius: 4px;
  141. border: 1px solid #ddd;
  142. margin-bottom: 20px;
  143. background-color: #f9f9f9;
  144. }
  145. .search_panel label {
  146. font-weight: bold;
  147. margin-right: 5px;
  148. }
  149. .search_panel .inputTxt {
  150. width: 200px;
  151. padding: 5px;
  152. border: 1px solid #ccc;
  153. border-radius: 3px;
  154. }
  155. .search_panel .searchgo {
  156. padding: 5px 15px;
  157. background-color: #337ab7;
  158. color: white;
  159. border: none;
  160. border-radius: 3px;
  161. cursor: pointer;
  162. }
  163. .search_panel .searchgo:hover {
  164. background-color: #286090;
  165. }
  166. .select1 {
  167. padding: 5px;
  168. border: 1px solid #ccc;
  169. border-radius: 3px;
  170. min-width: 200px;
  171. }
  172. </style>
  173. </head>
  174. <body>
  175. <div id="man_zone">
  176. <?php
  177. // Handle add/edit form display
  178. if ($act == 'add' || $act == 'edit') {
  179. $id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
  180. $is_edit = ($id > 0);
  181. if ($is_edit) {
  182. $sql = "SELECT * FROM products WHERE id = " . (int)$id;
  183. $result = mysqli_query($conn, $sql);
  184. if (mysqli_num_rows($result) > 0) {
  185. $row = mysqli_fetch_assoc($result);
  186. $product_name = htmlspecialcharsFix($row['ProductName']);
  187. $product_img = htmlspecialcharsFix($row['ProductImg']);
  188. $unit = htmlspecialcharsFix($row['unit']);
  189. $moq = htmlspecialcharsFix($row['moq']);
  190. $nosale = $row['nosale'];
  191. $note = htmlspecialcharsFix($row['note']);
  192. $tips = htmlspecialcharsFix($row['tips']);
  193. $category_id = $row['category_id'] ? intval($row['category_id']) : 0;
  194. } else {
  195. // Product not found, redirect
  196. header("Location: ?Keys=" . $keys . "&Page=" . $page);
  197. exit();
  198. }
  199. }
  200. $href_str = "?keys=" . $keys . "&Page=" . $page;
  201. ?>
  202. <form name="form1" method="post" action="<?php echo $href_str; ?>&act=save">
  203. <table width="100%" border="0" cellpadding="3" cellspacing="1" class="table1">
  204. <tbody>
  205. <tr>
  206. <th width="8%">产品名称</th>
  207. <td><input type="text" id="ProductName" name="ProductName" value="<?php echo $product_name; ?>" class="txt1" />
  208. <input type="hidden" name="id" value="<?php echo $id; ?>" /></td>
  209. </tr>
  210. <tr>
  211. <th width="8%">产品分类</th>
  212. <td>
  213. <select name="category_id" id="category_id" class="select1">
  214. <option value="0">-- 请选择分类 --</option>
  215. <?php
  216. // Include the category display functions
  217. require_once 'functions.php';
  218. // Build category tree
  219. $category_data = buildCategoryTree($conn);
  220. $cat_tree = $category_data['tree'];
  221. // Output options
  222. outputCategoryOptions($cat_tree, $category_id);
  223. ?>
  224. </select>
  225. </td>
  226. </tr>
  227. <tr>
  228. <th width="8%">产品图片</th>
  229. <td><input type="text" id="ProductImg" name="ProductImg" placeholder="186x*186px" value="<?php echo $product_img; ?>" class="txt1" style="width:390px;float:left;" />
  230. <iframe src="uploadfile.php" frameborder="0" scrolling="no" style="width:400px;height:22px;float:left;margin-left:10px;"></iframe></td>
  231. </tr>
  232. <tr>
  233. <th width="8%">计价单位</th>
  234. <td><input type="text" id="unit" name="unit" value="<?php echo $unit; ?>" class="txt1"/></td>
  235. </tr>
  236. <tr>
  237. <th width="8%">起订数量</th>
  238. <td><input type="text" id="moq" name="moq" value="<?php echo $moq; ?>" class="txt1"/></td>
  239. </tr>
  240. <tr>
  241. <th width="8%">默认售价</th>
  242. <td>
  243. <div class="Price">
  244. <?php
  245. if ($is_edit) {
  246. $price_sql = "SELECT num, price FROM price WHERE AreaId = 0 AND productId = " . $id . " ORDER BY num ASC";
  247. $price_result = mysqli_query($conn, $price_sql);
  248. if (mysqli_num_rows($price_result) > 0) {
  249. while ($price_row = mysqli_fetch_assoc($price_result)) {
  250. ?>
  251. <div class="priceitem">
  252. <label>≥</label>
  253. <input type="number" class="txt3 num" name="num[]" value="<?php echo $price_row['num']; ?>">
  254. <label class="unit"><?php echo $unit; ?></label>
  255. <label>售价</label>
  256. <input type="text" class="txt3 price" name="price[]" value="<?php echo $price_row['price']; ?>">
  257. <label>RMB</label>
  258. <span class="additem"></span>
  259. <span class="delitem"></span>
  260. <span class="note"></span>
  261. </div>
  262. <?php
  263. }
  264. }
  265. }
  266. if (!$is_edit || mysqli_num_rows($price_result) == 0) {
  267. ?>
  268. <div class="priceitem">
  269. <label>≥</label>
  270. <input type="number" class="txt3 num" name="num[]">
  271. <label class="unit"><?php echo $unit; ?></label>
  272. <label>售价</label>
  273. <input type="text" class="txt3 price" name="price[]">
  274. <label>RMB</label>
  275. <span class="additem"></span>
  276. <span class="delitem"></span>
  277. <span class="note"></span>
  278. </div>
  279. <?php
  280. }
  281. ?>
  282. </div>
  283. </td>
  284. </tr>
  285. <tr>
  286. <th width="8%">不报价地区</th>
  287. <td>
  288. <ul class="areadd">
  289. <?php
  290. if (!empty($nosale)) {
  291. // 确保nosale是逗号分隔的字符串格式
  292. $nosale_str = is_array($nosale) ? implode(',', $nosale) : $nosale;
  293. $area_sql = "SELECT id, countryName FROM country WHERE id IN(" . $nosale_str . ")";
  294. $area_result = mysqli_query($conn, $area_sql);
  295. while ($area_row = mysqli_fetch_assoc($area_result)) {
  296. ?>
  297. <li><input type="hidden" name="nosale[]" value="<?php echo $area_row['id']; ?>"><span class="cname"><?php echo htmlspecialcharsFix($area_row['countryName']); ?></span><span class="close"></span></li>
  298. <?php
  299. }
  300. }
  301. ?>
  302. </ul>
  303. <input type="text" id="AreaSearch" class="fastsearch">
  304. <div id="arealist" class="productlist"><ul></ul></div>
  305. </td>
  306. </tr>
  307. <tr>
  308. <th width="8%">不报价处理方式</th>
  309. <td><input type="text" id="note" name="note" value="<?php echo $note; ?>" class="txt1"/></td>
  310. </tr>
  311. <tr>
  312. <th width="8%">备注</th>
  313. <td><input type="text" id="tips" name="tips" value="<?php echo $tips; ?>" class="txt1"/></td>
  314. </tr>
  315. <tr>
  316. <th></th>
  317. <td colspan="2">
  318. <input type="submit" name="save" value="确定" class="btn1" />
  319. <input type="reset" name="reset" value="重置" class="btn1" />
  320. <input type="button" value="返回" class="btn1" onClick="location.href='<?php echo $href_str; ?>'" />
  321. </td>
  322. </tr>
  323. </tbody>
  324. </table>
  325. </form>
  326. <?php
  327. } else {
  328. // Display product list
  329. require_once 'functions.php';
  330. // Get filter category id
  331. $filter_category_id = isset($_GET['category_id']) ? intval($_GET['category_id']) : 0;
  332. // Prepare SQL condition for category filtering
  333. $category_condition = '';
  334. if ($filter_category_id > 0) {
  335. // Get all subcategories of the selected category
  336. $category_data = buildCategoryTree($conn);
  337. $all_categories = $category_data['all_categories'];
  338. $category_ids = array($filter_category_id);
  339. getSubcategoryIds($all_categories, $filter_category_id, $category_ids);
  340. $category_condition = " WHERE category_id IN (" . implode(',', $category_ids) . ")";
  341. }
  342. // Search condition
  343. $search_condition = '';
  344. if (!empty($keyscode)) {
  345. $search_condition = ($category_condition ? " AND " : " WHERE ") .
  346. "ProductName LIKE '%" . mysqli_real_escape_string($conn, $keyscode) . "%'";
  347. }
  348. // Get total records count using a COUNT query instead of fetching all records
  349. $count_sql = "SELECT COUNT(*) as total FROM products" . $category_condition . $search_condition;
  350. $count_result = mysqli_query($conn, $count_sql);
  351. $count_row = mysqli_fetch_assoc($count_result);
  352. $total_records = $count_row['total'];
  353. // 固定每页显示18条记录(与 customers.php 保持一致)
  354. $pageSize = 18;
  355. $total_pages = ceil($total_records / $pageSize);
  356. if ($total_pages < 1) $total_pages = 1; // 确保至少有一页,即使没有结果
  357. // Validate page number
  358. if (empty($page)) $page = 1;
  359. if ($page == 'end') $page = $total_pages;
  360. if (!is_numeric($page) || $page < 1) $page = 1;
  361. $page = (int)$page;
  362. if ($page > $total_pages) $page = $total_pages;
  363. // Apply pagination
  364. $offset = ($page - 1) * $pageSize;
  365. if ($offset < 0) $offset = 0; // 确保偏移量不为负数
  366. // Fetch only the records for the current page
  367. $sql = "SELECT id, ProductName, ProductImg, category_id FROM products" .
  368. $category_condition . $search_condition . " ORDER BY id DESC LIMIT $offset, $pageSize";
  369. $result = mysqli_query($conn, $sql);
  370. $temp_num = $pageSize * ($page - 1);
  371. ?>
  372. <div class="search_panel">
  373. <form method="get" action="">
  374. <input type="hidden" name="Page" value="1">
  375. <div style="display: flex; margin-bottom: 10px;">
  376. <div style="margin-right: 20px;">
  377. <label>按分类筛选:</label>
  378. <select name="category_id" class="select1" onchange="this.form.submit()">
  379. <option value="0">-- 所有分类 --</option>
  380. <?php
  381. // Build category tree for filter dropdown
  382. $category_data = buildCategoryTree($conn);
  383. $cat_tree = $category_data['tree'];
  384. // Output options
  385. outputCategoryOptions($cat_tree, $filter_category_id);
  386. ?>
  387. </select>
  388. </div>
  389. <div>
  390. <label>关键词搜索:</label>
  391. <input type="text" name="Keys" value="<?php echo $keyscode; ?>" class="inputTxt" placeholder="请输入产品名称">
  392. <input type="submit" value="搜索" class="searchgo">
  393. </div>
  394. <div style="margin-left: 20px;">
  395. <input type="button" value="+ 新增产品" onClick="location.href='?act=add<?php echo $filter_category_id ? '&category_id='.$filter_category_id : ''; ?>'" class="add_btn" />
  396. </div>
  397. </div>
  398. </form>
  399. </div>
  400. <form id="form1" method="post" action="?act=postchk&Keys=<?php echo $keys; ?>&Page=<?php echo $page; ?><?php echo $filter_category_id ? '&category_id='.$filter_category_id : ''; ?>" onSubmit="return false">
  401. <table width="100%" border="0" cellpadding="3" cellspacing="1" class="table1">
  402. <thead>
  403. <tr>
  404. <th width="4%"><input type="checkbox" name="chkall" id="chkall" onClick="chkboxall(this,'chkbox')" /></th>
  405. <th width="6%">序号</th>
  406. <th width="25%">产品名称</th>
  407. <th width="15%">产品分类</th>
  408. <th width="30%">图片</th>
  409. <th width="20%">操作</th>
  410. </tr>
  411. </thead>
  412. <tbody>
  413. <?php
  414. if (mysqli_num_rows($result) > 0) {
  415. $temp_num = $pageSize * ($page - 1);
  416. while ($row = mysqli_fetch_assoc($result)) {
  417. $temp_num++;
  418. ?>
  419. <tr onMouseOver="this.style.background='#F7FCFF'" onMouseOut="this.style.background='#FFFFFF'">
  420. <td align="center"><input type="checkbox" name="chkbox[]" value="<?php echo $row['id']; ?>" /></td>
  421. <td align="center"><?php echo $temp_num; ?></td>
  422. <td align="center"><?php echo htmlspecialcharsFix($row['ProductName']); ?></td>
  423. <td align="center">
  424. <?php
  425. require_once 'functions.php';
  426. echo getCategoryPath($conn, $row['category_id']);
  427. ?>
  428. </td>
  429. <td align="center"><img src="<?php echo htmlspecialcharsFix($row['ProductImg']); ?>" width="30px"></td>
  430. <td align="center">
  431. <a href="?Keys=<?php echo $keys; ?>&Page=<?php echo $page; ?>&act=edit&id=<?php echo $row['id']; ?>" class="ico_edit ico">修改</a>
  432. </td>
  433. </tr>
  434. <?php
  435. }
  436. } else {
  437. ?>
  438. <tr>
  439. <td colspan="9" align="center">
  440. <?php echo empty($keys) ? 'Sorry,当前暂无信息' : '<a href="?">Sorry,没有找到"' . htmlspecialcharsFix($keyscode) . '"相关的信息,点击返回</a>'; ?>
  441. </td>
  442. </tr>
  443. <?php
  444. }
  445. ?>
  446. </tbody>
  447. <tfoot>
  448. <tr>
  449. <td colspan="9">
  450. <div class="showpagebox">
  451. <?php
  452. if ($total_pages > 1) {
  453. // Build page URL with all parameters
  454. $page_params = array();
  455. if (!empty($keys)) $page_params[] = "Keys=" . urlencode($keys);
  456. if ($filter_category_id > 0) $page_params[] = "category_id=" . $filter_category_id;
  457. $page_name = "?" . implode("&", $page_params) . ($page_params ? "&" : "");
  458. $page_len = 3;
  459. // Previous page links
  460. if ($page > 1) {
  461. echo "<a href=\"{$page_name}Page=1\">首页</a>";
  462. echo "<a href=\"{$page_name}Page=" . ($page-1) . "\">上一页</a>";
  463. }
  464. // Calculate page range
  465. if ($page_len * 2 + 1 >= $total_pages) {
  466. $start_page = 1;
  467. $end_page = $total_pages;
  468. } else {
  469. if ($page <= $page_len + 1) {
  470. $start_page = 1;
  471. $end_page = $page_len * 2 + 1;
  472. } else {
  473. $start_page = $page - $page_len;
  474. $end_page = $page + $page_len;
  475. }
  476. if ($page + $page_len > $total_pages) {
  477. $start_page = $total_pages - $page_len * 2;
  478. $end_page = $total_pages;
  479. }
  480. }
  481. // Page numbers
  482. for ($i = $start_page; $i <= $end_page; $i++) {
  483. if ($i == $page) {
  484. echo "<a class=\"current\">$i</a>";
  485. } else {
  486. echo "<a href=\"{$page_name}Page=$i\">$i</a>";
  487. }
  488. }
  489. // Next page links
  490. if ($page < $total_pages) {
  491. if ($total_pages - $page > $page_len) {
  492. echo "<a href=\"{$page_name}Page=$total_pages\">...$total_pages</a>";
  493. }
  494. echo "<a href=\"{$page_name}Page=" . ($page+1) . "\">下一页</a>";
  495. echo "<a href=\"{$page_name}Page=$total_pages\">尾页</a>";
  496. }
  497. // Jump to page input
  498. echo "<input type=\"text\" id=\"Pagego\" value=\"$page\"
  499. onFocus=\"if(this.value == '$page'){this.value='';}\"
  500. onBlur=\"if(this.value == ''){this.value='$page';}\"
  501. onKeyUp=\"this.value=this.value.replace(/\D/g,'')\"
  502. onKeyDown=\"if(event.keyCode==13){location.href='{$page_name}Page='+document.getElementById('Pagego').value}\" />";
  503. }
  504. ?>
  505. </div>
  506. <div class="postchkbox">
  507. <select id="chkact" name="chkact">
  508. <option value="1">显示</option>
  509. <option value="0">隐藏</option>
  510. <option value="-1">删除</option>
  511. </select>
  512. <input type="button" value="执行" onClick="postchk(1)" class="btn1" />
  513. <input type="button" value="新增" onClick="location.href='?act=add'" class="btn1" />
  514. </div>
  515. </td>
  516. </tr>
  517. </tfoot>
  518. </table>
  519. </form>
  520. <?php
  521. }
  522. mysqli_close($conn);
  523. ?>
  524. </div>
  525. </body>
  526. </html>