Re: HTML quickform several forms

From: Date: Mon, 25 Oct 2004 21:52:58 +0000
Subject: Re: HTML quickform several forms
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-15104@lists.php.net to get a copy of this message
On Oct 25, 2004, at 5:27 PM, Oscar Karlsson wrote:
no form or no result should be shown if the page is accessed the normal way.
I believe what you want to do is put everything concerned with the form in your if statement so the logic for the form only gets processed if "action=insert" is in the URL. And also test to see if the form was submitted since QF submits to itself unless specified otherwise. [code] //take care of actions on this page if (isset($_GET['action'] or isset($_POST['mupp'] )) { $form = new HTML_QuickForm('input'); //insert a post
       if ($_GET['action'] == 'insert') {
           $form->addElement('header', null, 'add post');
           $form->addElement('text', 'mupp', 'Title (en)', array('size' => 50, 'maxlength' => 255));
           $form->addElement('submit', null, 'Send');
       }
if ($form->validate()) {
       print_r($form->exportValue('mupp'));
else
       $form->display();
} } - Erik Heerlein

« previous php.pear.general (#15104) next »