Forms
Forms
Phalcon\Forms
is a component that aids you in the creation and maintenance of forms in web applications.
The following example shows its basic usage:
use Phalcon\Forms\Form; use Phalcon\Forms\Element\Text; use Phalcon\Forms\Element\Select; $form = new Form(); $form->add( new Text( "name" ) ); $form->add( new Text( "telephone" ) ); $form->add( new Select( "telephoneType", [ "H" => "Home", "C" => "Cell", ] ) );
Forms can be rendered based on the form definition:
<h1> Contacts </h1> <form method="post"> <p> <label> Name </label> <?php echo $form->render("name"); ?> </p