[[start]]
 

Differences

This shows you the differences between two versions of the page.

start [2009/05/08 01:26]
127.0.0.1
start [2009/05/08 01:33] (current)
127.0.0.1
Line 1: Line 1:
{{ :logo-muuu.png | }} {{ :logo-muuu.png | }}
 +<code php>
 +include_once("muuu.class.php");
 +$form= new muuu("form","post","sandBox.php");
 +
 +// Se definen los campos
 +$form->addField("text","nombre","Nombre:");
 +$form->addField("text","correo","Correo:");
 +$form->addField("submit","submitButton","",array("fieldAdd"=>"value='Enviar'"));
 +
 +// Se definen las reglas
 +$form->addRule("required","nombre","El nombre es obligatorio");
 +$form->addRule("email","correo","El correo no tiene un formato correcto");
 +
 +
 +if($form->formSuccess()==true){
 +
 + // Aqui lo que haremos cuando el formulario sea enviado correctamente
 +
 +}else{
 +
 +        // Código para imprimir el formulario, sirve para cualquier número de campos 
 + $form->startForm();
 + echo "<fieldset>
 + <legend>Testing</legend>";
 + foreach($form->fieldsarray as $key=>$value){
 + echo "<p><label for='$key'>".$form->labelsarray[$key]."</label>$value</p>";
 + echo "<p id='instructions'>".$form->instructionsarray[$key]."</p>";
 + echo "<p id='error'>".$form->errorarray[$key]."</p>";
 + }
 + echo "</fieldset>";
 + $form->endForm();
 +
 +}
 +</code>
 
start.txt · Last modified: 2009/05/08 01:33 by 127.0.0.1
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki