All pastes #504544 Raw Edit

Mine

public text v1 · immutable
·published 2007-05-23 04:17 UTC
rendered paste body
========================
findaboat_form.inx.php
========================

  $findaboat_form['fields']['price_range'] = array( //mediumint(8) unsigned
                  'name' => 'Price Range', //text of question
                  'type' => 'listbox', //type of input
                  'size' => '20', //length of field
                  'maxlength' => '255', //max characters allowed
                  'minlength' => '0', //minimum length required
                  'answers' => $price_range, //if radio, check or listbox list of options available
                  'default_answer' => '', //default answer, if a text box or field can be text
                  'extra_text' => '',
                  'dynamic' => false,
                  'process' => false,
                  'select' => 'CONCAT(price_low,",",price_high) AS price_range'
                  'mandatory' => false);



========================
"dynamicform.class.php"
========================
foreach($form_config['fields'] as $field => $field_data)
{
    if ($field_data['dynamic'] == false)
    {
        if($field_data['type'] == 'date' or $field_data['type'] == 'datetime') //need to select as unix timestamp if date
        {
            $myarray[] = 'UNIX_TIMESTAMP('.$field.') AS '.$field;
        } elseif(!empty($field_data['select']))
        {
            $myarray[] = '$field_data['select']';
        } else
        {
            $myarray[] = $field;
        }
        $myfieldarray[] = $field; //we need a list of all fields anyway
    }
}