-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate-form.php
More file actions
190 lines (164 loc) · 6.46 KB
/
template-form.php
File metadata and controls
190 lines (164 loc) · 6.46 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
182
183
184
185
186
187
188
189
190
<?php
/* Template Name: New Merchants */
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bank Technology Consultant</title>
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/style.css">
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/fonts/font-awesome/css/font-awesome.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div class="complete-bar" id="bar"></div>
<div class="steps-sec" id="STEPS">
<div class="step-box" onclick="NextStep(1)">
<div class="step-number" id="StepNumber-1">
<div class="step-title">Step</div>
<div>1</div>
</div>
</div>
<div class="step-box" onclick="NextStep(2)" id="STEP">
<div class="step-number" id="StepNumber-2">
<div class="step-title">Step</div>
<di>2</di>
</div>
</div>
</div>
<form id="new-merchant-form" method="" action="">
<input name="merchant" type="text" style="display: none" value="new">
<div class="business-sec" id="Section-1">
<div class="business-sec-text">
<div class="business-sec-title">Contact Information</div>
</div>
<div>
<input id="Input-1" type="text" class="business-field" name="Name" placeholder="Name">
</div>
<div>
<input id="Input-2" type="text" class="business-field" name="BusinessName" placeholder="Business Name">
</div>
<div>
<input id="Input-3" type="text" class="business-field" name="Landline" placeholder="Landline">
</div>
<div>
<input id="Input-4" type="text" class="business-field" name="Mobile" placeholder="Mobile Number">
</div>
<div>
<input id="Input-5" type="email" class="business-field" name="Email" placeholder="Email Address">
</div>
<div class="customer-sec-btn" onclick="NextStep(2)">
<div>next step</div>
<div class="fa fa-angle-right customer-btn-icon" aria-hidden="true"></div>
</div>
<div class="back-sec">
<div class="back-sec-bg"></div>
<div class="back-text" onclick="location.href='<?php echo get_template_directory_uri(); ?>/home'">
<div class="fa fa-home back-icon"></div>
<div>Back to Home</div>
</div>
</div>
</div>
<div class="services-sec" id="Section-2">
<div class="services-sec-text">
<div class="services-sec-title">Which Services?</div>
<div>Please tick the box(s) of your choice</div>
</div>
<input id="Input-6" type="text" name="services" value="" style="display: none">
<div class="services-container">
<div class="service-box" id="Box-1" onclick="Select('1')">
<div class="service-title">On Line</div>
</div>
<div class="service-box" id="Box-2" onclick="Select('2')">
<div class="service-title">Face to Face</div>
</div>
<div class="service-box" id="Box-3" onclick="Select('3')">
<div class="service-title">Pay by Phone</div>
</div>
<div class="service-box" id="Box-4" onclick="Select('4')">
<div class="service-title">Pay by Text</div>
</div>
<div class="service-box" id="Box-5" onclick="Select('5')">
<div class="service-title">Pay by Mail</div>
</div>
</div>
<button type="submit" class="customer-sec-btn" id="GREEN" onclick="Confirm()">
<div>Send</div>
<div class="fa fa-angle-right customer-btn-icon" aria-hidden="true"></div>
</button>
</div>
</form>
<script src="<?php echo get_template_directory_uri(); ?>/js/jquery.min.js"></script>
<script>
$(function () {
$('#new-merchant-form').on('submit', function (e) {
e.preventDefault();
$.ajax({
type: 'post',
url: '',
data: $('#new-merchant-form').serialize(),
success: function () {
console.log('success!');
document.getElementById("new-merchant-form").reset();
},
error: function () {
console.log('Error!');
document.getElementById("new-merchant-form").reset();
},
done: function () {
console.log('Done!');
document.getElementById("new-merchant-form").reset();
}
});
});
});
</script>
<?php
if($_POST) {
//get data from ajax
$name = $_POST['Name'];
$business = $_POST['BusinessName'];
$landline = $_POST['Landline'];
$mobile = $_POST['Mobile'];
$email = $_POST['Email'];
$services = $_POST['services'];
//save message in database
$new_merchant = array(
'post_title' => $name." - ".$business,
'post_status' => 'publish',
'post_type' => 'Merchants'
);
$merchant_id = wp_insert_post( $new_merchant );
//add data to message
update_field('name', $name, $merchant_id);
update_field('business_name', $business, $merchant_id);
update_field('landline', $landline, $merchant_id);
update_field('mobile_number', $mobile, $merchant_id);
update_field('email_address', $email, $merchant_id);
update_field('services', $services, $merchant_id);
}
?>
<div class="confirm-sec" id="Section-3">
<div class="confirm-container" id="ConfirmContainer">
<div class="confirm-box confirm-animation" id="ConfirmCircle">
<div class="fa fa-check check-icon hide" aria-hidden="true" id="ConfirmCheck"></div>
</div>
</div>
<div class="confirm-text" id="ConfirmText">
<div class="confirm-title">Successfully Registered</div>
<div>We will contact you soon</div>
</div>
<div class="back-sec" id="BackHome">
<div class="back-sec-bg"></div>
<div class="back-text" onclick="location.href='<?php echo get_template_directory_uri(); ?>/home'">
<div class="fa fa-home back-icon"></div>
<div>Back to Home</div>
</div>
</div>
</div>
<footer>
<script src="<?php echo get_template_directory_uri(); ?>/js/jquery.min.js"></script>
<script src="<?php echo get_template_directory_uri(); ?>/js/customer.js" type="text/javascript"></script>
</footer>
</body>
</html>