PHP Classes
elePHPant
Icontem

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: 3 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";
    }
}