add_product.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. require_once('conn.php');
  3. require_once('functions.php');
  4. // Check login status
  5. checkLogin("信息管理");
  6. // Initialize variables
  7. $product_name = '';
  8. $product_img = '';
  9. $unit = '';
  10. $moq = '';
  11. $category_id = isset($_GET['category_id']) ? intval($_GET['category_id']) : 0;
  12. $note = '';
  13. $tips = '';
  14. $keys = isset($_GET['Keys']) ? urlencode($_GET['Keys']) : '';
  15. $page = isset($_GET['Page']) ? $_GET['Page'] : 1;
  16. // Get the return URL
  17. $href_str = "products.php?keys=" . $keys . "&Page=" . $page;
  18. if ($category_id) {
  19. $href_str .= "&category_id=" . $category_id;
  20. }
  21. ?>
  22. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  23. <html xmlns="http://www.w3.org/1999/xhtml">
  24. <head>
  25. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  26. <title>添加产品</title>
  27. <link rel="stylesheet" href="css/common.css" type="text/css" />
  28. <script language="javascript" src="js/jquery-1.7.2.min.js"></script>
  29. <script type="text/javascript" src="js/js.js"></script>
  30. <script type="text/javascript" src="js/SearchArea.js"></script>
  31. <script type="text/javascript" src="xheditor-1.1.9/xheditor-1.1.9-zh-cn.min.js"></script>
  32. </head>
  33. <body>
  34. <div id="man_zone">
  35. <form name="form1" method="post" action="save_product.php">
  36. <table width="100%" border="0" cellpadding="3" cellspacing="1" class="table1">
  37. <tbody>
  38. <tr>
  39. <th width="8%">产品名称</th>
  40. <td><input type="text" id="ProductName" name="ProductName" value="<?php echo $product_name; ?>" class="txt1" />
  41. <input type="hidden" name="id" value="" />
  42. <input type="hidden" name="keys" value="<?php echo $keys; ?>" />
  43. <input type="hidden" name="page" value="<?php echo $page; ?>" />
  44. <input type="hidden" name="category_id" value="<?php echo $category_id; ?>" />
  45. </td>
  46. </tr>
  47. <tr>
  48. <th width="8%">产品分类</th>
  49. <td>
  50. <select name="category_id" id="category_id" class="select1">
  51. <option value="0">-- 请选择分类 --</option>
  52. <?php
  53. // Build category tree
  54. $category_data = buildCategoryTree($conn);
  55. $cat_tree = $category_data['tree'];
  56. // Output options
  57. outputCategoryOptions($cat_tree, $category_id);
  58. ?>
  59. </select>
  60. </td>
  61. </tr>
  62. <tr>
  63. <th width="8%">产品图片</th>
  64. <td><input type="text" id="ProductImg" name="ProductImg" placeholder="186x*186px" value="<?php echo $product_img; ?>" class="txt1" style="width:390px;float:left;" />
  65. <iframe src="uploadfile.php" frameborder="0" scrolling="no" style="width:400px;height:22px;float:left;margin-left:10px;"></iframe></td>
  66. </tr>
  67. <tr>
  68. <th width="8%">计价单位</th>
  69. <td><input type="text" id="unit" name="unit" value="<?php echo $unit; ?>" class="txt1"/></td>
  70. </tr>
  71. <tr>
  72. <th width="8%">起订数量</th>
  73. <td><input type="text" id="moq" name="moq" value="<?php echo $moq; ?>" class="txt1"/></td>
  74. </tr>
  75. <tr>
  76. <th width="8%">默认售价</th>
  77. <td>
  78. <div class="Price">
  79. <div class="priceitem">
  80. <label>≥</label>
  81. <input type="number" class="txt3 num" name="num[]">
  82. <label class="unit"><?php echo $unit; ?></label>
  83. <label>售价</label>
  84. <input type="text" class="txt3 price" name="price[]">
  85. <label>RMB</label>
  86. <span class="additem"></span>
  87. <span class="delitem"></span>
  88. <span class="note"></span>
  89. </div>
  90. </div>
  91. </td>
  92. </tr>
  93. <tr>
  94. <th width="8%">不报价地区</th>
  95. <td>
  96. <ul class="areadd"></ul>
  97. <input type="text" id="AreaSearch" class="fastsearch">
  98. <div id="arealist" class="productlist"><ul></ul></div>
  99. </td>
  100. </tr>
  101. <tr>
  102. <th width="8%">不报价处理方式</th>
  103. <td><input type="text" id="note" name="note" value="<?php echo $note; ?>" class="txt1"/></td>
  104. </tr>
  105. <tr>
  106. <th width="8%">备注</th>
  107. <td><input type="text" id="tips" name="tips" value="<?php echo $tips; ?>" class="txt1"/></td>
  108. </tr>
  109. <tr>
  110. <th></th>
  111. <td colspan="2">
  112. <input type="submit" name="save" value="确定" class="btn1" />
  113. <input type="reset" name="reset" value="重置" class="btn1" />
  114. <input type="button" value="返回" class="btn1" onClick="location.href='<?php echo $href_str; ?>'" />
  115. </td>
  116. </tr>
  117. </tbody>
  118. </table>
  119. </form>
  120. </div>
  121. </body>
  122. </html>
  123. <?php mysqli_close($conn); ?>