Login   Register  
PHP Classes
elePHPant
Icontem

File: index3.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  >  index3.php  >  Download  
File: index3.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: 2006-04-24 07:30
Size: 2,065 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->labelBreak="</td><td>";
$Modulo->AlertJavascript="Attention please! Error in form.";
$Modulo->validation_client_side=true;
$Modulo->labelField("note","Notes","Needed") ;
$Modulo->labelField("DI","From date","Needed") ;
$Modulo->labelField("DE","To date","Needed") ;
$Modulo->labelField("mail","Insert email adress","Needed") ;
$Modulo->labelField("persone","Combo data","Needed") ;
$Modulo->labelField("clausola","Check","Needed") ;
//set up regular expressions for field validation
$Modulo->registerValidation("required",".+","The field is needed");
$Modulo->registerValidation("valid_email",'^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$',"Invalid email");
//create the javascript
$Modulo->validatejava("regExp","mail","valid_email");
$Modulo->validatejava("checkBox","clausola","","Check the value");
//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_box",
                    array(
                
"name"=>"mail",
                
"val"=>$campo['mail'] ));
$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("submit","Submit",
                    array(
                
"class"=>'bottone',
                
"val"=>"OK"));
$Modulo->add_campi("check","Check_box",
              array(
              
"name"=>"clausola",
              
"val"=>"1",
              
"valore_campo"=>$campo['clausola'],
              
"rif"=>"0",
              
"accesskey"=>"N"
              
));
$Modulo->add_php("pippo","This is a test string");

$Modulo->render("template/template3.tpl","GET","getresult.php");
?>

</body>
</html>