-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform.php
More file actions
182 lines (173 loc) · 5.92 KB
/
form.php
File metadata and controls
182 lines (173 loc) · 5.92 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<?php
/**
* Created by PhpStorm.
* User: shady
* Date: 3/3/19
* Time: 5:53 AM
*/
include "functions.php";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<title>Vue & PHP - ToDo List</title>
<!-- Bootstrap core CSS -->
<link href="./css/bootstrap.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="./css/narrow-jumbotron.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.21/dist/vue.js"></script>
<style>
.hide-element{
display: none;
}
</style>
</head>
<body>
<div class="container" id="app">
<div class="header clearfix">
<nav>
<ul class="nav nav-pills float-right">
<li class="nav-item">
<a class="nav-link" href="index.php">General</a>
</li>
<li class="nav-item">
<a class="nav-link" href="shop.php">Shopping Cart</a>
</li>
<li class="nav-item">
<a class="nav-link" href="todo.php">Tasks</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="form.php">Multi Form</a>
</li>
</ul>
</nav>
<h3 class="text-muted">Vue and PHP</h3>
</div>
<div class="container">
<div class="jumbotron">
<h1 class="display-3">A Multi-Form</h1>
<p>An events attendance form</p>
</div>
</div>
<form action="form.php" method="get">
<div class="container">
<div class="form-group">
<label for="exampleInputEmail1">Your Name</label>
<input v-model="name" name="name" type="text" class="form-control" placeholder="Enter your full name">
</div>
<div class="form-group">
<label for="exampleInputPassword1">Your Email</label>
<input v-model="email" type="email" class="form-control" placeholder="Enter your email">
</div>
<br>
</div>
<div class="container">
<div class="card">
<div class="card-header">
<h3 style="display: inline-block;">Attendee</h3>
<div class="float-right" style="display: inline-block;">
</div>
</div>
<div class="card-block">
<div class="form-group">
<label for="exampleFormControlInput1">Name</label>
<input v-model="aname" type="text" class="form-control" placeholder="Attendee Name">
</div>
<div class="form-group">
<label for="exampleFormControlInput1">Email address</label>
<input v-model="aemail" type="email" class="form-control" placeholder="name@example.com">
</div>
<div class="form-group">
<label for="exampleFormControlSelect1">Status</label>
<select v-model="status" class="form-control" name="status">
<option value="going">Going</option>
<option value="not sure">Not Sure</option>
<option value="rsvp">RSVP</option>
</select>
</div>
<button @click="addAttendee()" type="button" class="btn btn-success btn-block">Save Attendee</button>
</div>
</div>
</div>
<br><br>
<div class="container">
<div class="card">
<div class="card-header">
<h3 style="display: inline-block;">Form Preview</h3>
</div>
<div class="card-block">
<div>
Event Participant : {{ name }}<br>
Email : {{ email }}<br>
Participants : ({{ attendeesCount }})
</div><br>
<table class="table">
<thead>
<tr>
<th scope="col">Attendee Name</th>
<th scope="col">Email</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
<tr v-for="row in attendees">
<td>{{ row.name }}</td>
<td>{{ row.email }}</td>
<td>{{ row.status }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="container">
<input type="hidden" v-model="list" name="attendeesList">
<br>
<button type="submit" class="btn btn-primary btn-block">Submit Form</button>
<br>
</div>
</form>
<footer class="footer">
<p>© igestDevelopment 2019</p>
</footer>
</div> <!-- /container -->
<script>
var myObject = new Vue({
el: '#app',
data : {
name: "",
email: "",
status: "",
aname: "",
aemail: "",
items: "",
attendees: [],
list : []
},
methods: {
addAttendee() {
this.attendees.push({
"name" : this.aname,
"email" : this.aemail,
"status" : this.status
});
console.log(this.attendees);
this.aname = "";
this.aemail = "";
this.list = JSON.stringify(this.attendees);
},
},
computed: {
attendeesCount(){
return this.attendees.length;
}
}
})
</script>
</body>
</html>