-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu_index.php
More file actions
94 lines (87 loc) · 1.98 KB
/
menu_index.php
File metadata and controls
94 lines (87 loc) · 1.98 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
<?php
require_once (__DIR__.'/menu_class.php');
require_once (__DIR__.'/menu_insert.php');
require_once (__DIR__.'/menu_select.php');
require_once (__DIR__.'/menu_dequi.php');
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Menu</title>
<link rel="stylesheet" href="">
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<style>
.container{
width: 1000px;
margin: 0 auto;
}
</style>
<?php
$dequi = new Dequi();
$select = new Select();
if(isset($_POST['submit'])){
$menu_name = $_POST['menu_name'];
$parent_id = (int)$_POST['select_parent'];
$data = array('menu_name'=>$menu_name,'parent_id'=>$parent_id);
$insert = new Insert($data);
header('Location:'.$_SERVER['PHP_SELF']);
// echo '<pre>';
// print_r($menu->data);
// echo '</pre>';
}
?>
</head>
<body>
<div class="container">
<div class="menu">
<form action="" method="post">
<table border="1">
<tr>
<td colspan="2">
THÊM MENU
</td>
</tr>
<tr>
<td>
Menu name:
</td>
<td>
<input type="text" name="menu_name" id="menu_name" value="">
</td>
</tr>
<tr>
<td>Parent id:</td>
<td>
<select name="select_parent" id="">
<option value="" selected> ---- CHỌN ------- </option>
<?php $dequi->parent($select->data); ?>
</select>
</td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submit" id="submit" value="THÊM"></td>
</tr>
</table>
</form>
</div>
<div class="tree html">
<table border="1" cellspacing="0" cellpadding="5">
<?php $dequi->tree($select->data); ?>
</table>
</div>
</div>
<script>
$('#submit').click(function(){
var menu_name = $('#menu_name').val();
if(menu_name == ''){
alert('Tên menu không được để trống');
$('#menu_name').focus();
return false;
}
return true;
});
</script>
</body>
</html>