If you ever have an array with keys that match the names of your columns, you can use the fromArray() method to easily populate a table row with its values. When you submit a form, php delivers the form values in arrays such as $_GET, $_POST, and $_REQUEST. If you give your form inputs names that match your columns, you can easily populate your objects using fromArray() as follows:



require_once('config.php');

//Create new instance of the Book class
$b = new Book;
//Load variables from form into the instance of Book
$b->fromArray($_REQUEST);
//Save the Book to the database
$b->save();

?>

(503) 746-9116 | 17933 NW Evergreen Parkway, Suite 220 | Beaverton, Oregon 97006