-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimpleForm.php
More file actions
30 lines (24 loc) · 753 Bytes
/
simpleForm.php
File metadata and controls
30 lines (24 loc) · 753 Bytes
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
<?php
require_once('lib/class.defineForm.php');
require_once('lib/class.processForm.php');
kirbytext::$tags['simpleForm'] = array(
'attr' => array(
'fields',
'submit',
'confirmation'
),
'html' => function($tag) {
// If form was submitted go proces to form, else render the form
if ($_POST) {
$processForms = new processForm($tag->attr('simpleForm'), $_POST, $tag->page()->root());
if ($processForms->saveForm() == 'success'){
header('Location:'.$_SERVER['PHP_SELF'].'?sForm=true');
}
} else if ($_GET['sForm'] == true) {
return $tag->attr('confirmation');
} else {
$simpleForm = new simpleForm($tag->attr('simpleForm'), $tag->attr('fields'), $tag->attr('submit'));
return $simpleForm->createForm();
}
}
);