PHP Classes

File: examples/library/www/book_add.php

Recommend this page to a friend!
  Classes of Victor Bolshov   Tiny PHP ORM Framework   examples/library/www/book_add.php   Download  
File: examples/library/www/book_add.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Tiny PHP ORM Framework
Map objects to databases using composed queries
Author: By
Last change:
Date: 8 years ago
Size: 378 bytes
 

Contents

Class file image Download
<?php

use \library\Book,
    \
library\Registry;

include
__DIR__ . "/../bootstrap.php";

if (
"POST" == $_SERVER["REQUEST_METHOD"]) {
   
$book = new Book();
   
$book->title = trim($_POST["title"]);
    if (
$book->title) {
       
Registry::persistenceDriver()->save($book);
       
header("Location: books.php");
        exit;
    } else {
        echo
"Empty title";
    }
}