Returning a PHP script instead of the field value
In this example, in View mode only, the record id is used to query the database to get the data and apply the PHP function highlight_string() to the field contents.
Field array:
$opts['fdd']['clip'] = array(
'default' => '',
'input' => '',
'maxlen' => 65535,
'name' => 'Clip',
'options' => 'ACPVDFL',
'required' => false,
'select' => 'T',
'sqlw' => 'TRIM("$val_as")',
'textarea' => array('rows' => '20', 'cols' => '120'),
'trimlen|LF' => 50,
'sort' => false,
'php|V' => './triggers/highlight_string.php'
);
Contents of highlight_string.php
if ($this->operation == $this->labels['View']) {
if($row = mysql_fetch_row(mysql_query("SELECT `clip` FROM `code_library` WHERE `id` = '{$this->rec}'"))){
return highlight_string($row[0]);
}
}
PHP Form Generator Home
| PHP Form Generator Demo
|