Packy Posted December 12, 2007 Share Posted December 12, 2007 Hello hello, I have loaded XML file into textarea, after editing, how to save it? Going with: $sample = $HTTP_POST_VARS['XML_file_textarea']; $sample = $dom->saveXML(); $dom->save('XML/sample.xml'); does not work because I lose ane XML tag, I only have saved information between tags. Is this some validation issue where PHP delibarately strip tags or something else? Please help. Thanks... Here is complete code of page: <?php $dom = new DOMDocument; $dom->load('XML/sample.xml'); $dom->formatOutput = true; $sample = $dom->saveXML(); ?> <table border=1> <form name="XML_textarea" action="<?=$_SERVER['PHP_SELF']?>" method="post"> <tr> <td><textarea rows="30" cols="100" name="XML_file_textarea"><?php print $sample; ?></textarea></td> </tr> <tr> <td align="right"><input type="submit" name="submit" value="Submit"></td> </tr> </form> </table> <?php if ($HTTP_POST_VARS["submit"]=="Submit"){ $sample = $HTTP_POST_VARS['XML_file_textarea']; echo $sample . "<br><br><br>"; $sample = $dom->saveXML(); $dom->save('XML/sample.xml'); echo '<br>Changes saved.<br>'; } //if HTTP_POST_VARS ?> Link to comment https://forums.phpfreaks.com/topic/81273-save-xml-file-from-textarea-validation-problem/ Share on other sites More sharing options...
JacobYaYa Posted December 12, 2007 Share Posted December 12, 2007 You lose the <?xml tag ? I think you will have to use HTML entities to display them within the text area and then convert them to <? etc when you want to insert them to the database. Link to comment https://forums.phpfreaks.com/topic/81273-save-xml-file-from-textarea-validation-problem/#findComment-412456 Share on other sites More sharing options...
Packy Posted December 14, 2007 Author Share Posted December 14, 2007 I lose every tag... I only get values from elements. For example, XML file like this: <hotel>Paris</hotel> <room_number>5555</room_number> <beds>2</beds>, would give just: Paris55552 Thanks for reply... Link to comment https://forums.phpfreaks.com/topic/81273-save-xml-file-from-textarea-validation-problem/#findComment-415228 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.