<?php
//PostToDb.class.php
/* Example: without validating */
include_once('FormToDb.class.php');
//Incoming five vars: $_POST['name'], $_POST['email'], $_POST['message'], $_POST['checkbox_name'], $_POST['submit_req']
if( isset($_POST['submit_req']) )
{
$object = new FormToDb(_DB_HOST_, _DB_USER_, _DB_PASSWORD_, _DB_NAME_, 'my_table_name');
//...ignore these post variables
$object->toIgnore = array('submit_req', 'checkbox_name');
//...then cycle and save
$object->getFromPost($_POST);
if($object->getErrors() == FALSE);
$object->save();
}
?>
|