<?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->table="tb_prova";
$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("lingua","Language") ;
$Modulo->labelField("radio","Radio") ;
$Modulo->labelField("id_tb_immobile","Write a number","Needed") ;
$Modulo->labelField("persone","Combo data","Needed") ;
$Modulo->labelCaptcha("Code CAPTCHA");
//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);
$Modulo->validateCaptcha();
//carica i valori
$campo=$Modulo->carica_valori($_REQUEST[$Modulo->campo_chiave]);
//elabora
$id_record=$Modulo->elaboraForm();
//####################################################
if ($Modulo->success)
{
echo "OK";//code if the success insert
}
//creation array of data fields
$Modulo->add_campi("captcha", "captcha_field",
array(
"folder"=>"class",
"offuscamento"=>2,
"len_password"=>4
)); //folder key is relative to captcha.class.php
$Modulo->add_campi("Note","Text_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("radio","Radio_box",
array(
"name"=>"radio",
"valori"=> split(",","7,8,9,10"),
"labels"=> split(",","uno,due,tre,quattro"),
"valore_campo"=>$campo['radio'],
"rif"=>"7",
"style"=> "",
"id"=>$campo['radio']));
$Modulo->add_campi("DBcombo","DBCombo_Box",
array(
"name"=>"lingua",
"table_name"=> "lingue",
"order_by"=> "lingua",
"campo1"=> "lingua",
"campo2"=> "lingua",
"asc"=> "asc",
"style"=> "",
"id"=> $campo['lingua']
));
$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/template.tpl");
?>
</body>
</html>
|