PHP Classes

File: formCustomised.php

Recommend this page to a friend!
  Classes of Herman Veluwenkamp   xmlForm   formCustomised.php   Download  
File: formCustomised.php
Role: ???
Content type: text/plain
Description: Customised Example
Class: xmlForm
Generates a form in HTML.
Author: By
Last change:
Date: 22 years ago
Size: 1,509 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; } .formButton { border: #999999 1px solid; } .formText { border: #999999 1px solid; } .formError { font-weight: bold; color: red; } .formErrorRow { background: #eeeeee; } .formNoError { color: green; } TABLE { border: #999999 1px solid; } </style> </head> <body> <?php include 'xmlForm.php'; $xslForm = join('', file('formCustomised.xsl')); $xmlConfig = join('', file('formCustomisedDataConfig.xml')); $xmlForm = new xmlForm($xmlConfig); // do server-side validation $data = $HTTP_GET_VARS; if (!empty($data)) { if ($data['formAction']=='cancel') { print '<font size="+2">Action cancelled</font>'; } else { $result = $xmlForm->validate($data); if (!$result) print '<font size="+2">Validation Error</font>'; else print '<font size="+2">Data Accepted</font>'; $isValidated = 'yes'; } } else { print '<font size="+2">Please enter your details</font>'; $isValidated = ''; $data['formAction'] = ''; } print '<hr noshade color="black" size="1">'; if ($data['formAction'] != 'cancel') { // only display form if action has not been cancelled // prepare html form for display $result = $xmlForm->xslTransform($xslForm, array('isValidated' => $isValidated)); if ($result) print $xmlForm->output; else print $xmlForm->error; } ?> </body> </html>