PHP Classes

Form creator

Recommend this page to a friend!

      Form creator  >  All threads  >  Form creator  >  (Un) Subscribe thread alerts  
Subject:Form creator
Summary:How to
Messages:3
Author:Ferrand Gérard
Date:2012-10-21 10:21:09
Update:2012-10-22 17:06:24
 

  1. Form creator   Reply   Report abuse  
Picture of Ferrand Gérard Ferrand Gérard - 2012-10-21 10:21:09
Could you provide some explanation of the use of this class.
Thanks.

P.S. Excuse my bad english, is not my language.

  2. Re: Form creator   Reply   Report abuse  
Picture of catalin catalin - 2012-10-22 08:04:12 - In reply to message 1 from Ferrand Gérard
Hi.
In form.php file, in comment part of file, is an example of how to use this classes. But i will try here to show few things:
-first you need to load classes or use autoload function;

//initialise a new form
$form=new form();
//add attributes to form
$form->method='post'
$form->action=''
//add tag to form - default is table, so if you want to put your form in a //table don't need to add tags
//ATTENTION: if you change tags you MUST change all tags from elements and //labels.
$form->addTag(NULL)
//add first text element
$name=$form->addElement('name','text');
//add label for this element
$name->addLabel('Your name: ');
//add tag for label (default is td, if you change table MUST change
$name->addLabelTag('span');
//add attributes for element
$name->id='name';
$name->placeholder('Your name');
$name->addTag('span');//MUST
//add content tag for element togeter with label
$name->addMasterTag('div',array('id'=>'tagID'));
....
//print form
$form->showElements($name);

Something like this. If you have more questions I am here.

  3. Re: Form creator   Reply   Report abuse  
Picture of Ferrand Gérard Ferrand Gérard - 2012-10-22 17:06:24 - In reply to message 2 from catalin
Thank you for your answer. It works.
In this kind of exercise, I think it is always best to provide a working example for a better understanding of all.