All pastes #792407 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-11-21 11:09 UTC
rendered paste body
<?php

class Form {
	var $fields = array();
	var $procesor;
	var $submit = "Submit Form";
	var $Nfields = 0;

function __construct($procesor,$submit) {
	$this->procesor = $procesor;
	$this->submit = $submit;
}

function displayForm() {
	echo "<form action = '{$this->procesor}' method = 'post'";
	echo "<table>";
	for ($i=1;$i<=sizeof($this->fields);++$i) {
		echo "<tr><td>{$this->fields[$i-1]['label']}</td>";
		echo "<td><imput type = 'text' name = '{$this->fields[$i-1]['name']}'</td></tr>";
	}
}

echo "<tr><td><input type ='submit' value = '{$this->submit}'></td></tr>";
echo "</table>";

function addFields($name,$label){
	$this->fields[$this->Nfields]['name'] = $name;
	$this->fields[$this->Nfields]['label'] = $label;
	$this->Nfields = $this->Nfields + 1;
	}
}
?>