All pastes #904514 Raw Edit

class form

public php v1 · immutable
·published 2008-02-15 00:12 UTC
rendered paste body
<?php/** * @author TEAM MaTHeSis * @copyright 2008  */class Formulario{	var $campos = array();	var $procesador;	var $enviar = "Enviar Formulario";	var $Ncampos = 0;		function __construct($procesador,$enviar)	{		$this ->procesador = $procesador;		$this ->enviar = $enviar;	}	function mostrarFormulario()	{		echo "<form action='{$this->procesador}' method='post'>";		echo "<table width='100%'>";		for ($j=1;$j<= sizeof($this->campos); $j++)		{			echo "<tr><td align=\"right\">			{$this->campos[$j-1]['etiqueta']}: </td>\n";						echo "<td>				<input type = 'texto'				nombre='{$this->campos[$j-1]['nombre']}'>				</td></tr>\n";			}			echo "<tr> <td colspan=2 align='center'>			<input type='enviar'			valor= '{$this->enviar}'></td></tr>\n";			echo "</tabla>";				}	function agregarCampo($nombre,$etiqueta)	{$this->campos[$this->Ncampos]['nombre'] = $nombre;	  $this->campos[$this->Ncampos]['etiqueta']= $etiqueta;	   $this->Ncampos=$this->Ncampos +1;	   }	}?>