Location: PHPKode > scripts > MySQL Form Generator > mysql-form-generator/example1.php
<?
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
#                                                         #
#           DB Layer Example Page - Inserting             #
#           Tobie van der Spuy - 2001                     #
#           hide@address.com                          #
#                                                         #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

// Require Class Library
// =====================
   require('classes.inc.php');


// Prepare Form
// ============
   $db1 = new MySQLDB("mfgc","guest","guest","localhost");
   $db1->select();
   $form = new Form("form","Files",$PHP_SELF,"","","","none");
   $form->addtable($db1,"table1","","","","1","","","");
   $form->addtable($db1,"table2","","","","1","","","");
   $form->makefields();
   $form->describe("Row ID:/:/Row Surname:/:/Row Active?/:/Row ID:/:/Row Name:/:/Row Description:/:/Row Extra:");
   $submitvalue = $form->submit;
   

// If not submitted, display form, else display result
// ===================================================
   if (!$$submitvalue) {
   	  echo $form->build("200","10","200","3","40");
	  }
   else {
   		if ($form->submit()) {
		   echo $form->result("200","10","200");
		   echo "<a href=$PHP_SELF>Back</a>";
		   }
		else {
			 echo $error;
			 echo mysql_error();
			 echo "\n<br><a href=$PHP_SELF>Back</a>";
			 }
		}
?>
Return current item: MySQL Form Generator