PHP Classes

File: simpleform.php

Recommend this page to a friend!
  Classes of Huda M Elmatsani   Data Displayer   simpleform.php   Download  
File: simpleform.php
Role: Example script
Content type: text/plain
Description: example: form
Class: Data Displayer
Display MySQL query result data in various formats
Author: By
Last change:
Date: 20 years ago
Size: 1,978 bytes
 

Contents

Class file image Download
<?php
include("datadisplayer.php");

$datatable = new datadisplayer;
$datatable->set_db ("localhost","user","password","eproshop");
$datatable->set_rs ("SELECT prodID,prodtitle,prodcat FROM products");
$datatable->set_rs_aux ("aux_1","SELECT catID,catname FROM categories");
$datatable->set_page ($_REQUEST[page],8);
$datatable->set_data ();
$datatable->set_data_aux ("aux_1");

$datatable->set_tbl ("catalogue",array("border"=>"1","cellspacing"=>"0","cellpadding"=>"0","width"=>"250"));
$datatable->set_tbl_cols (array("code","name","cat"));

//$datatable->set_tbl_noheader ();
$datatable->set_tbl_header (array("bgcolor"=>"#CCCCCC","height"=>"30","style"=>"font-family: Arial, Helvetica; text-decoration:none;font-size:12"));
$datatable->set_tbl_rows (array("valign"=>"top","style"=>"font-family: Arial, Helvetica; text-decoration:none;font-size:11"));
$datatable->set_tbl_blankrows (5);

/* prepare form element */
//$datatable->set_form (array("name"=>"product","method"=>"post","action"=>"test.php"));
$datatable->set_form_text ("elm_1", "prodID", array("name"=>"prodid[]", "size"=>"10"));
$datatable->set_form_text ("elm_2", "prodtitle", array("name"=>"prodtitle[]", "size"=>"10"));
$datatable->set_form_text ("elm_3", "prodcat", array("name"=>"prodcat[]","size"=>"20"));

/* styles */
$datatable->set_style ("elm_1","width:50; background-color:#DEDEEF; color:#666666; font-size:11;font-family:Arial");
$datatable->set_style ("elm_2","width:200; background-color:#DEDEEF; color:#666666; font-size:11;font-family:Arial");
$datatable->set_style ("elm_3","width:20; background-color:#DEDEEF; color:#666666; font-size:11;font-family:Arial");

/* placements */
$datatable->assign(array("code" =>"elm_1","name"=>"elm_2","cat"=>"elm_3"));

echo
$datatable->get_result();
//print_r($datatable->get_xdata());
?>