Creating a basic form using the MK_Form class is easy. The below example demonstrates how you would build a form with email and password fields.
$fields = array( 'email' => array( 'label' => 'Email', 'type' => 'text', 'validation' => array( 'email' => array(), 'instance' => array() ) ), 'password' => array( 'label' => 'Password', 'type' => 'text', 'validation' => array( 'instance' => array(), ), 'attributes' => array( 'type' => 'password' ) ), 'login' => array( 'type' => 'submit', 'attributes' => array( 'value' => 'Login' ) ) ); $form = new MK_Form($fields); print $form->render();
The above form would have three fields.
The MK_Form::render() method returns the HTML for the form.