-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanual_enter.php
80 lines (64 loc) · 2.14 KB
/
manual_enter.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
<?php
include 'top.php';
?>
<div class="container">
<span class="fs-13 text-gray-soft"><a href="enter.php">뒤로 가기</a></span>
<h1 class="mb-1 text-center">메뉴 입력</h1>
<p class="fs-14 text-gray text-center mb-5">음식점명, 메뉴, 가격을 아는대로 입력해주세요.</p>
<form method="post" action="submit.php" onsubmit="return enter_check();" name="info">
<table id="res_table" class="table">
<tbody>
<tr>
<div class="input-group">
<input type="text" class="form-control" id="res_title" placeholder="음식점명" aria-label="음식점명" aria-describedby="basic-addon1" name="title" id="title" size="20">
</div>
</tr>
<br/>
<tr>
<td> <input type="text" class="form-control" placeholder="메뉴" name="menu[]" size="15"> </td>
<td> <input type="number" class="form-control" placeholder="가격" name="price[]" min=100 max="100000"> </td>
<td> </td>
</tr>
</tbody>
</table>
<blockquote class="blockquote text-center">
<button type="button" class="btn btn-outline-success" onClick="insRow()">추가</button>
</blockquote>
</br>
<button class="btn btn-success btn-block" type="submit" onClick="return frmCheck();">입력</button>
</form>
</div>
<script type="text/javascript">
function enter_check(){
var form = document.info;
form.title.value.replace(/ /gi, "");
//음식점명 입력했는지 검사
if(form.title.value=="") {
alert("음식점명을 입력하세요");
return false;
}
$("#title").bind("keyup",function(){
re = /[~!@\#$%^&*\()\-=+_']/gi;
var temp=$("#title").val();
if(re.test(temp)){ //특수문자가 포함되면 삭제하여 값으로 다시셋팅
$("#title").val(temp.replace(re,""));
}
});
}
function frmCheck(){
//나머지 입력했는지 검사
var form = document.info;
for(var i = 0; i <= form.elements.length - 1; i++) {
if(form.elements[i].name == "menu[]" || form.elements[i].name == "price[]") {
if(!form.elements[i].value) {
alert("값을 모두 입력하세요!");
form.elements[i].focus();
return false;
}
}
}
}
</script>
<?php
include 'footer.php';
?>