<?php
/****************************************************************************************************
* Author: Sameer Shelavale
* Email: sameer@possible.in, samiirds@gmail.com
* Author website: http://possible.in
* Phone: +91 9890103122
* License: AGPL3, You should keep Package name, Class name, Author name, Email and website credits.
* http://www.gnu.org/licenses/agpl-3.0.html
* For other type of licenses please contact the author.
* PHP Version: Tested on PHP 5.2.2 & 5.3.10
* Copyrights (C) 2012 Sameer Shelavale
*
****************************************************************************************************/
require_once( 'X2Form.php' );
require_once( 'X2FormElement.php' );
require_once( 'class.dbhelper.php' );
require_once( 'class.logger.php' );
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db('test', $link);
if (!$db_selected) {
die ('Can\'t select database : ' . mysql_error());
}
$formObj = new X2Form( 'DiamondForm', 'xmlfile', 'quidich_form.xml' );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Diplaying a Form using X2Form</title>
<link href="style.css" type="text/css" rel="stylesheet">
</head>
<body>
<div id="container">
<h1>Example 1: X2Form Form Generator</h1>
<h3>Displaying form stored in <a href="forms/quidich_form.xml">xml file</a></h3>
<?php echo $formObj->render(); ?>
</div>
<br/>
<br/>
</body>
</html>
|