Login   Register  
PHP Classes
elePHPant
Icontem

File: demo.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Deepak Patil  >  XML Manipulation  >  demo.php  >  Download  
File: demo.php
Role: Example script
Content type: text/plain
Description: demo script
Class: XML Manipulation
Parsing and access XML documents using SimpleXML
Author: By
Last change:
Date: 6 years ago
Size: 1,196 bytes
 

Contents

Class file image Download
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="DEEPAK PATIL">
<META NAME="Keywords" CONTENT="XML, SimpleXML, XMLParser">
<META NAME="Description" CONTENT="">
</HEAD>

<BODY>
<pre>
<center>
<h1>Demo :: SimpleXML </h1>
<hr>
<form name="sxp">
Select Error Code <select name="errorCode" onchange="document.sxp.submit();">
    <option value="-1">Please select the Error Code</option>
<?php
    
for($i=1001;$i<=1025;$i++)
    {
        
$selected ="";
        if(isset(
$_REQUEST["errorCode"]))
            if(
$i==$_REQUEST["errorCode"])
                
$selected ="SELECTED";
        echo 
"<option value=".$i." ".$selected.">Error Code : ".$i."</option>";
    }
?>
</select>
</form>

<hr>
<?php
if(isset($_REQUEST["errorCode"]))
{
    require_once(
"SimpleXMLParser.php");
    
$errorCode =$_REQUEST["errorCode"];
    
$sxp = new SimpleXMLParser('error.xml');
    
$result $sxp->getChildArray"ErrorList","id",$errorCode);
    echo 
"Error Code: <font color='red'>".$errorCode."</font>";
    echo 
"<br>Error Message: <font color='red'>".$result[msg]."</font>";
}
?>
</center></pre>
</BODY>
</HTML>