formulier-class
Code (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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
<?
class FORM
{
var $xhtml;
function check_xhtml()
{
$x = "";
if($this->xhtml == 1) $x = " /";
return $x;
}
function textarea($name="",$value="",$cols="",$rows="",$disabled="",$wrap="",$id="",$class="",$style="")
{
if($name != "") $name = " name=\"". $name ."\"";
if($cols != "") $cols = " cols=\"". $cols ."\"";
if($rows != "") $rows = " rows=\"". $rows ."\"";
if($wrap != "") $wrap = " wrap=\"". $wrap ."\"";
if($id != "") $id = " id=\"". $id ."\"";
if($class != "")$class = " class=\"". $class ."\"";
if($style != "")$style = " style=\"". $style ."\"";
return "<textarea". $name . $rows . $cols . $wrap . $style . $id . $class . $disabled .">". $value ."</textarea>\n";
}
function input($type="",$align="",$maxlength="",$alt="",$checked="",$disabled="",$value="",$id="",$class="",$style="")
{
if($this->check_xhtml() == " /" && $align != "") $style .= "float:". $align .";"; $align = "";
if($type == "image") $alt2 = " alt=\"". $alt ."\"";
elseif(($type == "checkbox" || $type == "radio") && ($checked == "checked"))
{ $checked2 = " checked"; }
if($type != "") $type = " type=\"". $type ."\"";
if($disabled != "") $disabled = " disabled";
if($style != "") $style = " style=\"". $style ."\"";
if($align != "") $align = " align=\"". $align ."\"";
if($maxlength != "") $maxlength = " maxlength=\"". $maxlength ."\"";
if($value != "") $value = " value=\"". $value ."\"";
if($id != "") $id = " id=\"". $id ."\"";
if($class != "") $class = " class=\"". $class ."\"";
if($style != "") $style = " style=\"". $style ."\"";
return "<input". $type . $align . $maxlength . $style . $alt2 . $value . $checked2 . $class . $id . $disabled . $this->check_xhtml() .">\n";
}
function form($action="",$method="",$name="",$target="",$id="",$class="")
{
if($action != "") $action = " action=\"". $action ."\"";
if($method != "") $method = " method=\"". $method ."\"";
if($name != "") $name = " name=\"". $name ."\"";
if($target != "") $target = " target=\"". $target ."\"";
if($id != "") $id = " id=\"". $id ."\"";
if($class != "") $class = " class=\"". $class ."\"";
return "<form". $action . $method . $target . $id . $class .">\n";
}
function formend()
{
return "</form>\n";
}
}
?>
class FORM
{
var $xhtml;
function check_xhtml()
{
$x = "";
if($this->xhtml == 1) $x = " /";
return $x;
}
function textarea($name="",$value="",$cols="",$rows="",$disabled="",$wrap="",$id="",$class="",$style="")
{
if($name != "") $name = " name=\"". $name ."\"";
if($cols != "") $cols = " cols=\"". $cols ."\"";
if($rows != "") $rows = " rows=\"". $rows ."\"";
if($wrap != "") $wrap = " wrap=\"". $wrap ."\"";
if($id != "") $id = " id=\"". $id ."\"";
if($class != "")$class = " class=\"". $class ."\"";
if($style != "")$style = " style=\"". $style ."\"";
return "<textarea". $name . $rows . $cols . $wrap . $style . $id . $class . $disabled .">". $value ."</textarea>\n";
}
function input($type="",$align="",$maxlength="",$alt="",$checked="",$disabled="",$value="",$id="",$class="",$style="")
{
if($this->check_xhtml() == " /" && $align != "") $style .= "float:". $align .";"; $align = "";
if($type == "image") $alt2 = " alt=\"". $alt ."\"";
elseif(($type == "checkbox" || $type == "radio") && ($checked == "checked"))
{ $checked2 = " checked"; }
if($type != "") $type = " type=\"". $type ."\"";
if($disabled != "") $disabled = " disabled";
if($style != "") $style = " style=\"". $style ."\"";
if($align != "") $align = " align=\"". $align ."\"";
if($maxlength != "") $maxlength = " maxlength=\"". $maxlength ."\"";
if($value != "") $value = " value=\"". $value ."\"";
if($id != "") $id = " id=\"". $id ."\"";
if($class != "") $class = " class=\"". $class ."\"";
if($style != "") $style = " style=\"". $style ."\"";
return "<input". $type . $align . $maxlength . $style . $alt2 . $value . $checked2 . $class . $id . $disabled . $this->check_xhtml() .">\n";
}
function form($action="",$method="",$name="",$target="",$id="",$class="")
{
if($action != "") $action = " action=\"". $action ."\"";
if($method != "") $method = " method=\"". $method ."\"";
if($name != "") $name = " name=\"". $name ."\"";
if($target != "") $target = " target=\"". $target ."\"";
if($id != "") $id = " id=\"". $id ."\"";
if($class != "") $class = " class=\"". $class ."\"";
return "<form". $action . $method . $target . $id . $class .">\n";
}
function formend()
{
return "</form>\n";
}
}
?>