Login   Register  
PHP Classes
elePHPant
Icontem

File: example_small.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Jonas Earendel  >  jForm Validator  >  example_small.php  >  Download  
File: example_small.php
Role: Example script
Content type: text/plain
Description: A small example
Class: jForm Validator
Validate forms with rules defined in form template
Author: By
Last change: Apparently I forgot to change sv_se to sv-SE.
Date: 1 year ago
Size: 932 bytes
 

Contents

Class file image Download
<?php

include_once('class.jForm.php');

$html '
    E-mail:<br />
    <input type="email" name="email" required="required" value="john@doe.com#" /><br />

    Url:<br />
    <input type="url" name="url" required="required" value="#http://jform.lagerwall.net/" /><br />
'
;

$form = new jForm($html,'sv-SE');

if(!empty(
$_POST) and $form -> validate($_POST))
{
    
$form->triggerError('The form has passed validation','email');
    
$form->triggerError('The form has passed validation','url');
}

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>jForm php form validation demo!</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<form method="post" action="">
    <?php echo $form->html4(); ?>
    <input type="submit" />
</form>
</body>
</html>