PClib demo site

<?php
/* project: Regex validation, optgroup select, popup window and button tag. */

//Include pclib framework
require 'pclib/pclib.php';

session_start();

//Create pclib application
$app = new PCApp('demo');

$datasource 'mysql://root@localhost/test';
$app->db = new PCDb($datasource);

//Load website template
$app->setLayout('tpl/website.tpl');

//Include font-awesome icons (we are using glyph "fa-bus" in the button)
$app->layout->addScripts('../css/font-awesome.min.css');

$form = new PCForm('tpl/orderform.tpl','orderform');
if (
$form->submitted) {
  if (
$form->validate()) $app->message('Your order has been submitted.');
  
$app->redirect('orderform');
}

print 
$form//If working with app->layout template, use lines below instead.

/*
//Putting form into website template
$app->setContent($form);
$app->out();
*/
?>

Elapsed time: 12.16 ms