--------- CSS --------------------

<style type="text/css">

.cssform p {
	width: 300px;
	clear: left;
	padding: 5px 0 8px 0;
	padding-left: 155px;
	height: 1%;
}

.cssform label {
	float: left;
	margin-left: -155px;
}

</style>

-------------- PHP -----------------------

<?php

class form
{	
	var $start;
	var $body;
	var $end;
	var $html;
	
	function __construct($name = "Verstuur", $target, $method = "POST", $reset = false) {
		$id = strtolower(str_replace(' ', '_', $name));
		$this->start = "<form class='cssform' name='".$id."' action='".$target."' method='".$method."'>";
		$this->end .= "<p>";
		if ($reset) $this->end .= "<input type='reset' value='Stel opnieuw in' />";
		$this->end .= "<input type='submit' name='".$id."' value='".$name."' /></p>";
		$this->end .= "</form>";
		$this->html = $this->start . $this->end;
	}	
	
	function input($type, $name, $value) {
		$id = strtolower(str_replace(' ', '_', $name));
		switch ($type) {		
		case 'text':
		case 'password':
			$this->body .= "<p><label for='".$id."'>".$name.": </label>";
			$this->body .= "<input type='".$type."' name='".$id."' id='".$id."' value='".$value."' /></p>";
			break;
		case 'hidden':
			$this->body .= "<input type='hidden' name='".$id."' id='".$id."' value='".$value."' />";
			break;
		case 'checkbox':
			$this->body .= "<p>";
			$this->body .= "<input type='checkbox' name='".$id."' id='".$id."' value='".$value."' /> ".$value."<br />";
			$this->body .= "</p>";
			break;
		case 'radio':
			$this->body .= "<p><label>".$name.": </label>";
			foreach ($value as $option) {
				$optionId = strtolower(str_replace(' ', '_', $option));
				$this->body .= "<input type='radio' name='".$id."' id='".$id."' value='".$optionId."' /> ".$option."<br />";
			}
			$this->body .= "</p>";
			break;
		case 'file':
			$this->body .= "<p><label for='".$id."'>".$name.": </label>";
			$this->body .= "<input type='file' name='".$id."' id='".$id."' value='Kies bestand' /></p>";			
			break;
		case 'select':
			$this->body .= "<p><label for='".$id."'>".$name.": </label>";
			$this->body .= "<select name='".$id."' id='".$id."'>";
			foreach ($value as $option) {
				$optionId = strtolower(str_replace(' ', '_', $option));
				$this->body .= "<option value='".$optionId."'>".$option."</option>";
			}
			$this->body .= "</select></p>";			
			break;
		case 'textarea':
			$this->body .= "<p><label for='".$id."'>".$name.": </label>";
			$this->body .= "<textarea name='".$id."' id='".$id."'>".$value."</textarea></p>";
			break;
		}
		$this->html = $this->start . $this->body . $this->end;
	}
}

?>