Banner image

This is the older method of form generation usign a PHP class

Forms can be rendered by using the tools class but we now prefer to use HTML directly written into a view file in conjunction with the new form javascript biscuits-forms.js.
Our biscuits-forms.js functions pick up data- attributes to define the validation to do for each form input or textarea.

These are still commonly used throughout the biscuits engine functions


Modify an existing row

        $this->tools = new tools();
        $formSpec   =   array(
            'form_id'           =>  'edit_transaction',
            'id'                =>  $transactionId,
            'table'             =>  'et_sales',
            'access_allowed'    =>  $access_allowed,
            'fields'    =>   array(
                'account'      =>  'Account Name',
                'transactionId'     =>  'Transaction ID',
                'description'       =>  'Description',
                'amount'            =>  'Amount',
                'display_date_paid' =>  'Date Paid',
            'fldReadOnly'      =>  array(
                'account'       =>  true,
                'transactionId' =>  true,
                'display_date_paid' => true,
            'set_values'    =>  array(
                'userid'        =>  $row['userid'],                
                'account'       =>  $account['username'],
                'transactionId' =>  $transactionId,
                'display_date_paid'  =>  date("D dS M Y ",$row['date_paid']),


The DB pdate

Biscuits forms post the form data on submission back to the same page. The tools.php class detects that post data has been submitted and takes care of the DB update.
This is detected by the inclusion of a hidden form input in all forms.

            if (isset($_POST['tools-form'])) {
                        if ($_POST['tools-form'] == $this->form_id) {
                // Remember! the form may not validate and so can be posted again after amending the data. 


iBiscuits LOGO

380 memberDB.php INSERT INTO et_page_visits ( vuid,vpage,vreferrer,vtime,vlang,vagent,vbot,vversion,vguest,vip) VALUES ( "1","","Unknown","1534616756","","CCBot/2.0 (","","biscuits-12y","","") ON DUPLICATE KEY UPDATE vuid = "1" ,vpage = "" ,vreferrer = "Unknown" ,vtime = "1534616756" ,vlang = "" ,vagent = "CCBot/2.0 (" ,vbot = "" ,vversion = "biscuits-12y" ,vguest = "" ,vip = ""
538 engine.php getContent help