Location: PHPKode > scripts > Auto form > simple_example.php
 * This script is developed by Arturs Sosins aka ar2rsawseen, http://code-snippets.co.cc
 * Fee free to distribute and modify code, but keep reference to its creator
 * Auto form class can generate simple update, insert, select and delete 
 * HTML forms, form validation and form processing programmatically
 * based on information from mysql table
 * For more information, examples and online documentation visit: 
 * http://code-snippets.co.cc/PHP-classes/Generate-forms-programmatically
//database connection

//form class

//on success

function success($result)
	if($result === false)
		echo "<p>No connection</p>";
	else if($result === 0)
		echo "<p>No id generated</p>";
		echo "<p>New id is ".$result."</p>";

$form = new auto_form($serverlink);

//exclude table columns
$ex = array("ID");

//language array
$lang = array(
	"int" => "Integer", "decimal" => "Decimal", 
	"double" => "Float", "text" => "Text", 
	"bool" => "Checkbox", "enum" => "Select", 
	"set" => "Multiple select", "varchar" => "Default");

//set on success function

//insert form
echo "<fieldset>";
echo "<legend>Insert form</legend>";
$form->insert_form("test_table", $ex);
echo "</fieldset>";

//update form
echo "<fieldset>";
echo "<legend>Update form</legend>";
$form->update_form("test_table", "WHERE ID = '1'", $ex);
echo "</fieldset>";
Return current item: Auto form