PHP Classes

File: usagedescription.txt

Recommend this page to a friend!
  Classes of Hasin Hayder   phpFormGenerator   usagedescription.txt   Download  
File: usagedescription.txt
Role: Documentation
Content type: text/plain
Description: Detailed Example
Class: phpFormGenerator
Generate code to process form and insert MySQL row
Author: By
Last change:
Date: 18 years ago
Size: 1,279 bytes


Class file image Download
phpFormGenerator is a class file which dynamically creates input form from mysql table or your query and a handler routine that automatically handles your input and insert them into table. A basic validation is also included. Following is the usage of phpFormGenerator. include_once("phpFormGen.php"); $prg = new phpFormGenerator(); //Decoration $prg->width = "100%"; $prg->cellpad = "0"; $prg->cellspace = "0"; $prg->border = "0"; //Decoration End mysql_connect("localhost","root","root"); mysql_select_db("automation_system"); //Which fields are available in input form?? this comes from //following query $res = mysql_query("select * from classtest"); //Or you may say (select id, roll, name from classtest) //Pass the resource to FormGenerator $prg->mysql_resource = $res; //login information for the handler PHP $prg->db_host="localhost"; $prg->db_name="automation_system"; $prg->db_pwd="root"; $prg->db_user="root"; $prg->table_name="classtest"; //login and necessary info end //This is the key field that user must type. If its empty, record //will notbe inserted into table and an error message will be //shown $prg->key_field="id"; //Now generate The form file. $prg->generateInsert();