-
Notifications
You must be signed in to change notification settings - Fork 0
/
management.php
117 lines (107 loc) · 6 KB
/
management.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<? include("header.php");?>
<div id="main">
<div class="row">
<div class="col-md-1">
</div>
<div class="col-md-2" align="left">
<table class="table table-hover">
<tr><td class="success" onClick="location.href='management.php'"><center>我的商品</center></td></tr>
<tr><td onClick="location.href='management_wanted.php'"><center>我的需求</center></td></tr>
<tr><td onClick="location.href='management_removed.php'"><center>已下架商品/需求</center></td></tr>
<tr><td onClick="location.href='management_idle.php'"><center>閒置商品/需求</center></td></tr>
</table>
</div>
<div class="col-md-9">
<?php
$username=$_SESSION['MM_Username'];
include_once("mysql_info.php");
$sql = "select m.id, m.username, i.* from member m, item_forsell i where m.id = i.owner and m.username = '$username' and status = 1 order by i.id desc";
$result = mysqli_query($link,$sql);
$total_fields=mysqli_num_fields($result); // 取得欄位數
$total_records=mysqli_num_rows($result); // 取得記錄數
?>
<?php
$totalCount = ceil($total_records/3)*3;
echo '<table align=left>';
for($k = 0; $k < $totalCount; $k ++) {
if($k%3 == 0) { echo '<tr class="row">'; }
if($row = mysqli_fetch_array($result)) {
echo '<td class="col-xs-9 col-md-4 col-md-offset-1">
<div class="item_wrapper" style="margin-bottom:20px">
<form action="management_database.php" method="post" style="max-width:360px">
<table class="manage_item_table" width="100%">
<tr>
<td colspan="2">
<div class="item_img_wrapper" style="background:url(Picture/'.$row[filename].'_1.jpg) no-repeat center center; background-size:230px"></div>
</td>
</tr>
<tr>
<td style="min-width:35px">名稱</td>
<td>
<input type="text" name="name" class="form-control" value="'. $row[name].'">
<input type="hidden" name="id" value="'.$row[id].'"/>
</td>
</tr>
<tr>
<td style="vertical-align:middle;">描述</td>
<td style="max-width:360px">
<textarea name="detail" id="detail" pattern=".{0,100}" class="form-control" rows="3">'.$row[detail].'</textarea>
</td>
</tr>
<tr>
<td>價格</td>
<td>
<input type="text" name="price" class="form-control" value="'.$row[price].'">
</td>
</tr>
<tr>
<td>方式</td>
<td>
<input type="text" name="method" class="form-control" value="'.$row[method].'">
</td>
</tr>
<tr>
<td>分類</td>
<td>
<select name="sort" id="sort" class="form-control">'; ?>
<option value="" <?php if($row['sort']=='') echo 'selected=selected'; ?>>商品分類</option>
<option value="life" <?php if($row['sort']=='life') echo 'selected=selected'; ?>>生活用品</option>
<option value="sport" <?php if($row['sort']=='sport') echo 'selected=selected'; ?>>運動用品</option>
<option value="3c" <?php if($row['sort']=='3c') echo 'selected=selected'; ?>>3C產品</option>
<option value="transportation" <?php if($row['sort']=='transportation') echo 'selected=selected'; ?>>交通工具</option>
<option value="clothes" <?php if($row['sort']=='clothes') echo 'selected=selected'; ?>>衣褲鞋帽</option>
<option value="stationary" <?php if($row['sort']=='stationary') echo 'selected=selected'; ?>>文具</option>
<option value="book" <?php if($row['sort']=='book') echo 'selected=selected'; ?>>課外讀物</option>
<option value="textbook" <?php if($row['sort']=='textbook') echo 'selected=selected'; ?>>教科書</option>
<option value="makeup" <?php if($row['sort']=='makeup') echo 'selected=selected'; ?>>美妝保養</option>
<option value="furniture" <?php if($row['sort']=='furniture') echo 'selected=selected'; ?>>傢俱</option>
<option value="games" <?php if($row['sort']=='games') echo 'selected=selected'; ?>>各式遊戲</option>
<option value="else" <?php if($row['sort']=='else') echo 'selected=selected'; ?>>其他</option>
<option value="giving" <?php if($row['sort']=='giving') echo 'selected=selected'; ?>>贈送</option>
<?php
echo '</select></td></tr><tr>
<td colspan="2">
<center><input type="submit" value="修改" class="btn btn-success">
<input type="hidden" value="item" name="type">
<input type="submit" value="下架" class="btn btn-danger" formaction="delete_item.php""></center>
</td>
</tr>
</table>
</form>
</div>
</td>';
}
else{
echo "<td class=\"col-xs-9 col-md-4 col-md-offset-1\"></td>";
}
if($k%3 == 2) {
echo '</tr>';
}
}
echo '</table>';
?>
</div>
</div>
</div><!-- // end #main -->
</div>
<? include("footer.php");?>