How does php write form data into XML files?

Source: Internet
Author: User
How does php write form data into XML files? How does php write form data into XML files? I am asking for advice. it is best to show the code section !, PHPcoderequire ('config. php'); $ doc = newDOMDocument ('1. 0', & quot; gb2312 & php how to write form data into XML files?
How does php write form data into XML files?

I am asking for advice. it is best to show the code segment!

------ Solution --------------------
PHP code
require('config.php');$doc = new DOMDocument('1.0', "gb2312");$root = $doc->createElement('URL');$root = $doc->appendChild($root);$sql = "select * from cdb_forums";$result = mysql_query($sql);while($row = mysql_fetch_array($result)){  $imgnode = createNode($root, "Image_Information");  createNode($imgnode, "img_link", $row['fid']);  createNode($imgnode, "big_image", $row['type']);  createNode($imgnode, "thumb_image", $row['status']);}$doc->save("./update.xml");function createNode(&$pNode, $nodeName, $nodeValue='', $nodeAttribute = array()){  global $doc;  $node = $doc->createElement($nodeName);  if($nodeValue != "")  {  $nodeText = $doc->createTextNode($nodeValue);  $node->appendChild($nodeText);  }  if(sizeof($nodeAttribute) > 1)  {  foreach($nodeAttribute as $key=>$value)  {  $node->setAttribute($key, $value);  }  }  $pNode->appendChild($node);  return $node;}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.