Code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 
<?php  
 
include_once('../Datagrid.php');
 
$expamle = new Datagrid();
$expamle->tables = "`customer`";
//aim to-> SELECT `cus_id` ,`cus_name`,`cus_address`,`cus_phone`  FROM `customer`  
$expamle->fields = array("cus_id","cus_name","cus_email","cus_address","cus_phone");
$expamle->fieldDisplays = array("cus_name"=>"Customer's name","cus_email"=>"Email","cus_address"=>"Address","cus_phone"=>"Phone");
$expamle->title = "List of customer";
 
$expamle->formTable  = "`customer`";
$expamle->formFields = array("cus_name"=>"Customer's name",
                           "cus_email"=>"Email",
                           "cus_address"=>"Address",
                           "cus_phone"=>"Phone");
 
//easy to  change Formfield 's  attribute
$expamle->formAttributes = array("cus_name"=>'style="background:#FFFF00" ',
                                    "cus_email"=>'readonly="true" style="background:#CCCCCC"');
 
$html = $expamle->display();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<link type="text/css" rel="stylesheet" href="../css/bluedream.css" /> 
<title>Customers</title>
 <body  >
 <table >
  <tr>
    <td><a href="?" >back</a>,  Add form:  <a href="?datagrid_action=new" >here</a></td>
  </tr>
</table>
<?php 
echo $html;
?>
 
</body>
</html>             

Click here to run