PHP Submit Wrong codes to XML

huyhyper

New Member
i have an xml file (scores.xml) which im using a php codes to add new Tags to it.i have a tag called Header which contain some html code\[code\]<![CDATA[<tr><td colspan='7' id='headertd'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img border='0' src='http://stackoverflow.com/questions/10676285/images/euro.png' />&nbsp;&nbsp;&nbsp;&nbsp;UEFA Euro 2012 Qualifications</td></tr>]]>\[/code\]when im writing this code in the form of the pgp script and submiting everything goes normal to the XML file except the header tag.... im getting an error in the php script and the code is going in the xml tag like that:\[code\]<![CDATA[<tr><td colspan='7' id='headertd'>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<img border='0' src='http://stackoverflow.com/questions/10676285/images/euro.png' />
&nbsp;&nbsp;&nbsp;&nbsp;
UEFA Euro 2012 Qualifications</td></tr>]]>\[/code\]so thats getting wrong info to my xml...is there anyway i can fix this ? and avoid the transformation of these codes?thats my php code :\[code\]<?phpif (isset($_POST['submitted'])) {//If the user submitted the form, then add to the XML file //Load the scores XML file $scores = new DOMDocument(); $scores -> load('../scores.xml'); //Get the <Games> tag $games = $scores -> getElementsByTagName('Games'); //Create the new <Game> tag $newGame = $scores -> createElement("Game"); $newGame -> appendChild($scores -> createElement("Header", $_POST['header'])); //Add the new <Game> tag under the <Games> tag $games -> item(0) -> appendChild($newGame); //Save again $scores -> save('../scores.xml'); echo "New game added.";}?><form id="form1" method="post" action="">Header: <textarea style=" color:#000;" name="header" cols="73" rows="6" > </textarea><br><input type="submit" name="submitted" name="Add new row"></form>\[/code\]i have no user interface im just using this script to make work easier for me to post stuff on my website!your help is much appreciated!Thanks in Advance!
 
Back
Top