- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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
class forms {
//put your code here
function __construct($name,$id,$method,$action) {
echo "<form id='$id' name='id' method='$method' action='$action'>";
}
static private function attr($param) {
if ($param) {
foreach ($param as $nam_attr => $val_attr) {
$attribs.=$nam_attr."='".$val_attr."'";
}
return $attribs;
}
}
static private function label($id,$text,$attr) {
$key = array_search('regue', $attr, true);
if ($key = 1) $text.="<font color='red'>*</font>";
return "<label for='$id'>$text</label>";
}
static public function inputs($text,$type,$name,$id,$value=false,$class=false, $attr=false) {
return self::label($id,$text,$attr)."<input type='$type' name='$name' id='$id' value='$value' class='$class' ".self::attr($attr)."/>";
}
static public function inputs_chek($text,$type,$name,$id,$value=false,$class=false, $attr=false) {
return self::label($id,$text,$attr)."<input type='$type' name='$name' id='$id' class='$class' ".self::attr($attr)."/>$value";
}
static public function area($text,$name,$id,$value=false,$class=false, $attr=false) {
return self::label($id,$text,$attr)."<TEXTAREA NAME='$name' id='$id' WRAP='virtual' COLS='40' ROWS='3' ".self::attr($attr).">$value</TEXTAREA>";
}
static public function select($text,$name,$id,$value=false,$class=false, $attr=false) {
$select="<select name='$name' id='$id' ".self::attr($attr).">";
foreach($value as $value => $val_text) {
$select.="<option value='$value'>$val_text</option>";
}
$select.="</select>";
return self::label($id,$text,$attr).$select;
}
function __destruct() {
echo "<input type='submit'/><input type='reset' value='Очистить'></form>";
}
}
wmmorgun 21.02.2011 12:41 # 0
Govnocoder#0xFF 21.02.2011 13:55 # +2
Vasiliy 21.02.2011 14:25 # 0
Мистер Хэнки 21.02.2011 14:36 # 0
Vasiliy 21.02.2011 16:51 # 0
Lure Of Chaos 21.02.2011 23:51 # +3