PHP Classes

File: demo.php

Recommend this page to a friend!
  Classes of Brant Messenger   3SS Data Description Form   demo.php   Download  
File: demo.php
Role: Example script
Content type: text/plain
Description: Demonstration file
Class: 3SS Data Description Form
Form, Validate and SQL from Database Schema
Author: By
Last change: - Fixed Error
- Added Onsubmit variable
Date: 18 years ago
Size: 1,972 bytes
 

Contents

Class file image Download
<html>
<head>
<title>3 Service Solution - threessDDF Class Test</title>
<style type="text/css">
<!--
th.reqCSSclass {background-color:#c00}
td.reqCSSclass {border-left:4px solid #f30}
-->
</style>
<script language="javascript" type="text/javascript" src="validate.js"></script>
</head>
<body>

<?php
require_once('ez_sql.php');
require_once(
'threessddf.class.php');

$data = $db->get_row("SELECT * FROM tableName",ARRAY_A);

// SET CLASS OBJECT
$ddf = new threessDDF($db,'tableName',32,$data,'reqCSSclass');

echo
'
<b>TABLE</b> : '
.$ddf->table.'<br />
<b>COUNT</b> : '
.$ddf->count.'<br />
<b>DEFAULT INPUT SIZE</b> : '
.$ddf->size.'<br />';
?>

<table width="98%" cellpadding="0" cellspacing="0" border="1">
<?php
foreach($ddf->obj as $o) // SET FORM ELEMENT
{
    echo
'
    <tr>
        <th class="'
.$o->required.'" rowspan="9">'.$o->title.'</th>
        <td>FORM ELEMENT : '
.$o->form.'</td>
        <td>HIDDEN FIELD : '
.$o->formHidden.'</td>
        <td>SET AS NULL : '
.$o->null.'</td>
        <td>DEFAULT VALUE : '
.$o->default.'</td>
        <td>FILE FIELD : '
.$o->formUpload.'</td>
        <td>CSS CLASS IN NOT NULL : '
.$o->required.'</td>
        <td>FORM ELEMENT WITH CURRENCY : '
.$o->formCurrency.'</td>
        <td>ARRAY OF VALUES : <pre>'
.print_r($o->values,true).'</pre></td>
        <td>SQL NAME AND VALUE : '
.$o->sqlValue.'</td>
    </tr>'
;
}
?>
</table>


<script language="javascript" type="text/javascript">
<!--
<?php echo $ddf->jsValidate; ?>
//-->
</script>


<form action="" method="post" onsubmit="<?php echo $ddf->jsOnsubmit; ?>">

<table width="98%" cellpadding="0" cellspacing="0" border="1">
<?php
foreach($ddf->obj as $o) // SET FORM ELEMENT
{
    echo
'
    <tr>
        <th>'
.$o->title.'</th>
        <td class="'
.$o->required.'">'.$o->form.'</td>
    </tr>'
;
}
?>
<tr><td colspan="2"><input type="submit" /> <input type="reset" /></td></tr>
</table>
</form>

</body>
</html>