Login   Register  
PHP Classes
elePHPant
Icontem

File: index2.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Andrea Bersi  >  Forms generator for MYSQL  >  index2.php  >  Download  
File: index2.php
Role: Example script
Content type: text/plain
Description: example
Class: Forms generator for MYSQL
Generate forms to edit MySQL table records
Author: By
Last change:
Date: 8 years ago
Size: 2,623 bytes
 

Contents

Class file image Download
<?php
session_start
();
ob_start();?>
<html>
<head>
<title>Andrea Bersi - applicazioni web. Mysql Forms generator</title>
<body>
<?
##########################################
require_once("class/db.conf.php");
require_once(
"class/form.class.php");
//create instance
$Modulo = new Form();
$Modulo->FormName="form1";
$Modulo->feedback="yes";
$Modulo->labelBreak="</td><td>";
$Modulo->validation_client_side=true;
$Modulo->labelField("note","Notes","Needed") ;
$Modulo->labelField("DI","From date","Needed") ;
$Modulo->labelField("DE","To date","Needed") ;
$Modulo->labelField("id_tb_immobile","Write a number","Needed") ;
$Modulo->labelField("persone","Combo data","Needed") ;
//set up regular expressions for field validation
$Modulo->registerValidation("required",".+","The field is needed");
//crea il java
$Modulo->validatejava("regExp","note","required","Notes: The field is needed!");
$Modulo->validatejava("regExp","id_tb_immobile","required","Please insert a number");
//valida lato server
$Modulo->validateField("note","required");
$Modulo->compareFields("DI","DE","The data input is not valable","date prev",1);
//carica i valori 
//$campo=$Modulo->carica_valori($_REQUEST[$Modulo->campo_chiave]);
//elabora
$id_record=$Modulo->elaboraForm();

//#################################################### 
if ($Modulo->success)
{
    echo 
"WWW->".($Modulo->success);header("location:stop.php");//code if the success insert
}
//creation array of data fields
$Modulo->add_campi("Note","Tiny_Area",
                    array(
                
"name"=>"note",
                
"val"=> $campo['note'],
                
"rows"=>"10",
                
"cols"=>"80")) ;
$Modulo->add_campi("numero","Input_Numeric_box",
                    array(
                
"name"=>"id_tb_immobile",
                
"val"=>$campo['id_tb_immobile'] ));
$Modulo->add_campi("combo","Combo_Box",
                    array(
                
"name"=>"persone",
                
"valori"=> split(",","1,2,3,4,5,6,7,8"),
                
"style"=> "",
                
"id"=>$campo['persone']));                     
$Modulo->add_campi("calendario1","CreateCalendar",
                    array(
                
"date_initial"=>$campo['DI'],
                
"folder"=>"class",
                
"name"=>"DI",
                
"link_back"=>date("m/d/Y"),
                
"link_next"=>"01/01/2999"));
$Modulo->add_campi("calendario2","CreateCalendar",
                    array(
                
"date_initial"=>$campo['DE'],
                
"folder"=>"class",
                
"name"=>"DE",
                
"link_back"=>date("m/d/Y"),
                
"link_next"=>"01/01/2999"));
$Modulo->add_campi("submit","Submit",
                    array(
                
"class"=>'bottone',
                
"val"=>"OK"));

$Modulo->add_php("pippo","This is a test string");

$Modulo->render("template/template2.txt");
?>

</body>
</html>