Forms

A Pancake form is enclosed in calls to the Pancake::start() and Pancake::end() methods:

<?php
include_once 'Pancake/Pancake.php';
$form = new \Pancake\Pancake;
?>

<?= $form->start() ?>
    // Form contents...
<?= $form->end() ?>

HTML attributes

You can specify HTML attributes for the <form> tag by passing the Pancake::start() method an associative array wherein the key is the name of the attribute:

<?= $form->start(array(
    'class' => 'application',
    'enctype' => 'multipart/form-data'
)) ?>
    // Form contents...
<?= $form->end() ?>

Form identifiers

In order to allow multiple Pancake-powered forms on a single webpage, each form utilises its submit button as a ‘form identifier’. If the form identifier is present in the POST data, Pancake knows with which form to associate the data. This ability requires the submit buttons to be named uniquely. Again, you only need to worry about form identifiers if your page contains more than one Pancake-powered form.

Table Of Contents

Previous topic

Topics

Next topic

Form fields

This Page