Skip to content
eliasdorneles edited this page Aug 3, 2012 · 5 revisions

Purpose

The idea is simple (and copied from Rails): it is a helper that creates a post form with a submit button. Optionally, it can have input hiddens as a array in the last parameter.

It has great value in lists of records that have options that are not "elegant" send them as get parameters.

Usage


 'value' )) ?>


 'Button value', 'class' => 'css Class') ,
             'controller/action', array('hidden_name' => 'value' )) ?>

Helper code:

config->site_url($destination)}' method='post'>";

        if (!empty($hiddens))
        {
            foreach ($hiddens as $key => $value)
                $html .= "";
        }

        if (is_array($button_format))
        {
            $html .= " $value)
                $html .= $key . "='". $value . "' ";
    
            $html .= "/>";
        } else {
            $html .= "";
        }
        $html .= "";
        return $html;
    }
}

Clone this wiki locally