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();
|