<!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>
|