Login   Register  
PHP Classes
elePHPant
Icontem

File: formServerValidated.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Herman Veluwenkamp  >  xmlForm  >  formServerValidated.php  >  Download  
File: formServerValidated.php
Role: ???
Content type: text/plain
Description: Server Validation Example
Class: xmlForm
Generates a form in HTML.
Author: By
Last change:
Date: 12 years ago
Size: 815 bytes
 

Contents

Class file image Download
<html>
<head><title>form template test</title>
<style>
body,td,select,textarea,input,pre
              { font: 9pt "arial", "helvetica", sans-serif; }
</style>
<script language="javascript" src="validate.js"></script>
</head>
<body>

<?php
include 'xmlForm.php';

$xslForm   = join('', file('formServerValidated.xsl'));
$xmlConfig = join('', file('formDataConfig.xml'));

$xmlForm  = new xmlForm($xmlConfig);

// do server-side validation
$data = $HTTP_GET_VARS;
if (!empty($data)) {
  $result     = $xmlForm->validate($data);
  if (!$result) print "<h2>Validation Error</h2>";
  else print "<h2>Data OK</h2>";
}

// prepare html form for display
$result = $xmlForm->xslTransform($xslForm, array());
if ($result) print $xmlForm->output;
else print $xmlForm->error;
?>
</body>
</html>