Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //this is class.form.php
- <?php
- class formular {
- public function formStart($name,$method){
- return '<form name="'.$name.'" method="'.$method.'">';
- }
- public function inputText($name,$value){
- return $value . ': <input type="text" name="'.$name.'" />';
- }
- public function select($name,$array,$value){
- $str='<select name="'.$name.'">';
- foreach ($array as $option) {
- $str.='<option>'.$option.'</option>';
- }
- $str.='</select>';
- return $str;
- }
- public function submit($name){
- return '<input type="submit" name="'.$name.'" value="'.$name.'" />';
- }
- public function formslut(){
- return '</form>';
- }
- }
- ?>
- //this is the index
- <?php
- include('class.form.php');
- $minForm = new formular();
- echo $minForm->formStart("minForm", "POST");
- echo $minForm->inputText("navn", "Navn") . "<br />";
- $tal = array(0, 3, 7, 12, 34, 58);
- echo $minForm->select("tal", $tal, "Vælg tal") . "<br />";
- echo $minForm->submit("Send");
- echo $minForm->formslut();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement