Hi everyone, I have been asked to help extract data from a xml file and use the data to input into html form designed in php
I have read a few articles but im missing the point some how...
On the file that im trying to get the data to I have the following at the top
//file name to get
$file = "hpi.xml";
//load xml file
$xml = simplexml_load_file($file) or die ("Unable to load XML file!");
There are no errors so I assume the file is loading correctly
Here is the test xml file i have been provided with
<?xml version="1.0" ?>
<HPICheck_Query VRM="A15TPH" VIN="">
<enquiry_number>000001</enquiry_number>
<product_code>HPI11</product_code>
<FirstReg>
<Date>01/12/94</Date>
<vin_vrm_indicator>1</vin_vrm_indicator>
</FirstReg>
<Basic>
<Vrm>A15TPH</Vrm>
<Fuel>Petrol</Fuel>
<Transmission />
<Make> - <![CDATA[ MERCEDES]]>
</Make>
<Model> - <![CDATA[ 200 E 4V]]>
</Model>
<Engine_No>11194020001833</Engine_No>
<DVLA_Body_Plan_Description>4 Door Saloon</DVLA_Body_Plan_Description>
<SMMT_Door_Plan_Code />
<Engine_Size>01998</Engine_Size>
<DVLA_Body_Plan_Code>02</DVLA_Body_Plan_Code>
<Make_Code>M2</Make_Code>
<fuel_code>1</fuel_code>
<SMMT_Door_Plan_Description />
<Colour_Code>M</Colour_Code>
<Door_Plan>4 Door Saloon</Door_Plan>
<Colour>SILVER</Colour>
<Model_Code>277</Model_Code>
<transmission_code />
<Vin />
</Basic>
<Additional>
<Prev_Colour>RED</Prev_Colour>
<Wheelplan>2 Axle Rigid Body</Wheelplan>
<Wheelplan_code>C</Wheelplan_code>
<Mfr_Year>1994</Mfr_Year>
<Import_Flag>No</Import_Flag>
<original_colour_code>M</original_colour_code>
<Export_Date />
<Data_Source />
<number_of_previous_colours>02</number_of_previous_colours>
<last_previous_colour_code />
<Weight>1234567</Weight>
<original_colour_desc>SILVER</original_colour_desc>
<Prev_Colour_Code>C</Prev_Colour_Code>
<Scrap_Date />
<last_previous_colour_code_desc />
<Prev_Colour_Date>08/08/1999</Prev_Colour_Date>
</Additional>
<Keeper>
<Keepers>000</Keepers>
<previous_keeper_disposal_date />
<previous_keeper_acquisition_date />
<Kpr_Change />
</Keeper>
<Summary>
<Veh_Regd>Recorded</Veh_Regd>
<Plate_Xfr>Not Recorded</Plate_Xfr>
<Sec_Watch>0</Sec_Watch>
<Stolen>0</Stolen>
<Finance>0</Finance>
<Cond_Damgd>0</Cond_Damgd>
<Cond_Theft>0</Cond_Theft>
<Cond_Hist>0</Cond_Hist>
<VIN_Match>Not Matched</VIN_Match>
<Session>01011613383459</Session>
</Summary>
<Misc_Data>
<Date>Tue Jan 16 2001 13:39:34</Date>
</Misc_Data>
</HPICheck_Query>
What I am trying to do is extract the information from the above xml file and place into the form using php - like this
<tr>
<td width="9"> </td>
<td width="142" valign="top"><div align="right" class="p"> <img src="img/arrow.png" width="16" height="16" hspace="2" vspace="2" align="right" />Make </div></td>
<td width="346"><div class="ta">
<input name="make" type="text" class="ta" id="make" size="35" maxlength="30" value="<?php echo $xml->Make; ?>" /><div class="smalltext">Make of vehical</div><?php echo $msg_title; ?></div></td>
<td width="13"> </td>
</tr>
But for some reason, no data is being displayed in the textbox on the form -
Where is it that I am going wrong ! If someone could show me how to get the first 2-3 items from the xml, I will work through the rest, teaching myself as I go along
Many thanks for taking your time to read this post and any help would be appreciated