list.php
2.34 KB
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
<?php
require "function.php";
$url = "http://localhost.vchangyi.org/E92B06237F00000150F5A2266E14186D/Message/Apicp/Message/List";
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$postData = $_GET;
$postData['page'] = $page;
$message_list = curlPost($url,$postData);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>留言列表</title>
<script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
<style type="text/css">
table{
width: 300px;
margin: 30px auto;
border-spacing: 0px;
border-collapse: 0px;
border: solid #fff 1px
}
table tr td{
border: solid #000 1px
}
form{
width: 300px;
margin: 20px auto;
}
</style>
<script type="text/javascript">
function search()
{
key = '';
key = $('#select_id option:selected').val();
value = $('#input_id').val();
url = "http://127.0.0.1/message/list" + "?" + key + "=" + value;
// url = "http://127.0.0.1/message/listajax" + "?" + key + "=" + value;
window.location.href=url;
//location.reload(url)
console.log(url);
// $.ajax({
// url:url,
// type:"get",
// dataType:"text",
// success:function(data){
// $('#tab > tbody').html(data);
// console.log(data);
// // console.log('ok');
// }
// })
}
</script>
</head>
<body>
<h4 align="center">留言列表</h4>
<form>
<select id='select_id'>
<option value="name">姓名</option>
<option value="sex">性别</option>
<option value="mobile">手机号</option>
<option value="email">邮箱</option>
<option value="title">标题</option>
</select>
<input id="input_id" type="text">
<input type="button" onclick="search()" name="" value="搜索">
</form>
<table id="tab">
<thead>
<tr> <td>ID</td> <td>标题</td> <td>留言</td><td>操作</td> </tr>
</thead>
<tbody>
<?php
if ($message_list) {
foreach ($message_list as $key => $message) {
echo "<tr> <td>{$message['message_id']}</td> <td>{$message['title']}</td> <td>{$message['message']}</td><td><a href= 'del?message_id={$message['message_id']}'>删除</a>|<a href= 'detail?message_id={$message['message_id']}'>详情</a></td></tr>";
}
}
?>
</tbody>
</table>
</body>
</html>