-
Notifications
You must be signed in to change notification settings - Fork 0
/
future.php
49 lines (38 loc) · 1.18 KB
/
future.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
<?php
$f = new Form("UserEdit");
$f->input('name')
->label("Naam")
->minlen(2)
->empty(true)
->nospecialchars();
$f->select('gender')
->label("Geslacht")
->values(array("m" => "Man", "f" => "Female")); // (k = key, v = value, l = sublist name) can be [kv,kv] OR {k => v} OR {l => {k => v}} OR {l => [kv]}
$f->hidden('insertTime')
->onInsert(time())
->noUpdate();
$f->hidden('updateTime')
->onInsert(time())
->onUpdate(time());
$f->datepicker('birthdate')
->label('Geboortedatum')
->default(date('d-M-Y H:i:m'));
if(isset($_GET['id'])){
$id = $f->remember($_GET['id']);
//update
if($f->submitted()){
$data = $f->export();
DB::update('user',$data,"id=%d",$id);
}
$user = DB::queryFirstRow("select * from user where id = %d");
$f->import($user);
}else{
//insert
if($f->submitted()){
$data = $f->export();
DB::insert('user',$data);
CORE::redirect("user/".DB::insertId());
}
}
$pageVars['errors'] = $f->errors();
$pageVars['form'] = $f->html();