-
Notifications
You must be signed in to change notification settings - Fork 3
/
form.php
39 lines (34 loc) · 917 Bytes
/
form.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
<?php
// handle form submission
if (count($_POST)) {
// set cms section for fields and validation
$cms->set_section('enquiries');
// handle ajax form validation
$cms->submit_handler();
}
?>
<h1>Contact form</h1>
<p>
This form is validated with ShiftLib using an ajax request.<br>
The result is shown using a <a href="https://handlebarsjs.com/" target="_blank">handlebars template</a>.
</p>
<form method="post" sl-validate sl-hide sl-target="#thanks">
<p>
<input type="text" name="name" placeholder="name">
</p>
<p>
<input type="email" name="email" placeholder="email">
</p>
<p>
<textarea name="enquiry" placeholder="enquiry"></textarea>
</p>
<button type="submit">Submit</button>
</form>
<div id="thanks" style="display: none;">
<p>
Thanks {{ name }}, we will be in touch..
</p>
</div>
<?php
load_js('shiftlib');
?>