Location: PHPKode > scripts > basic_db > basic_db/insert_sample.php
<?

include('basic_db.php');

if(!$_POST['submit'])
{
?>
	<form action="<?=$_SERVER['PHP_SELF']?>" method="post" name="account">
	First Name <input name="firstname" type="text" size="25" /><br>
	Last Name <input name="lastname" type="text" size="25" /><br>
	<input name="xxx" type="hidden" value="4" />
	<input name="yyy" type="hidden" value="4" />
	<input name="submit" type="submit" value="Go" />
	</form>
<?
}
else
{
	$db = new Database;
	$db->Table_Name('accounts');
	$db->Fields($HTTP_POST_VARS);
	$db->doPrint(); // This is for debugging purposes to echo the query, so it's optional.
	$db->hidden(array('xxx', 'yyy')); // Use this when only incase you have hidden inputs.
	$id = $db->Insert();

	if($id)
	{
		echo "Data has been inserted in record # ".$id;
	}
	else
	{
		echo "There was an error inserting the data, please check your conncetion information";
	}
}
Return current item: basic_db