form.class.php
1.27 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
<?php
class renderForm {
var $html = TRUE;
var $tableid = '';
function __construct() {
$a = 1;
}
function start($action, $method) {
$this->ret .= "<form action='$action' method='$method'>\n";
if($this->html) {
$this->ret .= "<table id='" . $this->tableid . "' class='" . $this->tableclass . "'>\n";
}
}
function br() {
if($this->html) {
$this->ret .= "<tr><td colspan='2'> </td></tr>";
} else {
$this->ret .= "<br>";
}
}
function inp($description, $name, $type='text', $value='', $checked=FALSE) {
$check = $checked == TRUE ? "checked='checked'" : "";
if ($this->html) {
$this->ret .= "<tr>\n
\t<td>".$description."</td>\n
\t<td><input type='".$type."' name='".$name."' value='".$value."' ". $check ."/></td>\n
</tr>";
} else {
$this->ret .= "$description <input type='".$type."' name='".$name."' value='".$value."' />";
}
}
function end() {
if($this->html) {
$this->ret .= "</table>\n";
}
$this->ret .= "</form>\n";
return $this->ret;
}
}
?>