<?php

// Formular class
// Date: 2012-06-19

class Form
{
	
  protected $action = '';
  protected $method = 'post';
  protected $inputs = array();
  protected $title = '';

  function __construct($inputs,$title,$action = '',$method = 'post')
  {
	$this->action = $action;
	$this->title = $title;
	$this->method = $method;
	$this->inputs = $inputs;
  }
  
  function Show() {
	if ($this->title != '') echo ('<strong>'.$this->title.'</strong>');
    echo('
		<form action="'.$this->action.'" method="'.$this->method.'">
		<table>');
	  
    foreach($this->inputs as $name => $type)
    {
      if ($type == 'submit') {
		echo '<tr><td><input type="'.$type.'" value="'.$name.'" /></td></tr>';
	  } else {
		echo '<tr><td><input type="'.$type.'" name="'.$name.'" /></td></tr>';
	  }
    }
	  
    echo('</table>
         </form>');
  	  
  }
  
}
?>
