PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Andres Dario Gutierrez Poveda  >  Forms class  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: Forms class
Create HTML forms to submit MySQL table records
Author: By
Last change: New way to use the AddJavas function.
Date: 12 years ago
Size: 1,585 bytes


Class file image Download

$contratolink = mysql_connect($host,$username,$password);
$contratodb = mysql_select_db($db);
$contrato = new Forms($contratolink,$contratodb,$tablename,1);

//call submit method if form has been submitted
//retrieve a record for update if GET var set

//hide primary key field, force a few field types

//order of the fields

//get data pairs from another table
$contrato->normalizedField("fk_estadocontratoid","estadocontrato","id","nombre","1","nombre ASC");

//set custom field labels
$contrato->labelFields( array("nome","cognome "),array("Nome","Cog Nome "));

//Choose the methods to validate.
$validaciones['isEmailAddr'] = 1;
$validaciones['validRequired'] = 1;
$validaciones['allDigits'] = 1;
$validaciones['allDigitss'] = 1;
$validaciones['inValidCharSet'] = 1;
$validaciones['validNum'] = 1;
$validaciones['validInt'] = 1;
$validaciones['validDate'] = 1;
$validaciones['validDatetime'] = 1;
$validaciones['validForm'] = 1;

//output form
echo $contrato->AddJavas($validaciones);