PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Fernando Alls   Form Persistence   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example, formPersistence in action
Class: Form Persistence
Save submitted form values in session variables
Author: By
Last change: alter type
Date: 11 years ago
Size: 1,755 bytes
 

Contents

Class file image Download
<style>
body{font-family:"Verdana"; margin:40px;}
input.button{padding:7px 15px 7px 15px; color:#666; font-size:14px; font-family:"Trebuchet MS", Arial; background-image:url('http://img834.imageshack.us/img834/6568/cfbtn.jpg'); border:1px solid #B3B3B3; border-radius:5px; text-decoration:none;}
input.button:hover{padding:7px 15px 7px 15px; color:#666; background-image:url('http://img189.imageshack.us/img189/2044/cfbtnhover.jpg'); border:1px solid #B3B3B3; border-radius:5px; text-decoration:none;}
.textbox{padding:7px 15px 7px 0px; color:#666;font-family:"Trebuchet MS", Arial; border:1px solid #B3B3B3; border-radius:5px;}
i{color:red;}
</style>
<form action="" method="post">
<?php
require_once('Persistence.class.php');
$Validate = new Persistence();
?>
Name:<br>
<input type="text" name="name" value="<?php echo @$_SESSION['name']; ?>" class="textbox"><br>
<input type="hidden" name="send"><br>

Email:<br>
<input type="text" name="email" value="<?php echo @$_SESSION['email']; ?>" class="textbox"><br>

City:<br>
<input type="text" name="city" value="<?php echo @$_SESSION['city']; ?>" class="textbox"><br>

State:<br>
<input type="text" name="state" value="<?php echo @$_SESSION['state']; ?>" class="textbox"><br>


<input type="submit" value="Enviar" class="button"><br>

</form>

<?php
if(isset($_POST['send']))
 {
 
$name = $_POST['name'];
 
$email = $_POST['email'];
 
$city = $_POST['city'];
 
$state = $_POST['state'];
 

 
$Validate->FieldValidate($name, 'name');
 
$Validate->FieldValidate($email, 'email');
 
$Validate->FieldValidate($city, 'city');
 
$Validate->FieldValidate($state, 'state');
 
$Validate->EndValidate($data = array ('name', 'email', 'city', 'state'));

 }
?>