XML : My php code for adding data to xml doesn't perform as it should? [duplicate]

This question already has an answer here:

i am trying to add data into xml,using php code,but it doesn't appear to be working properly,as the page shows parts of the code,so mainly it's not being parsed,and i can't seem to find a solution to that,any help?

this is the html code :

      <form name="deposit" action="deposit.php" method="post">      <ul>      <li><input type="text" name="title" required placeholder="Title"></li>      <li><input type="text" name="cast" required placeholder="Cast..."></li>      <li><input type="text" name="director" required placeholder="Director"></li>      <li><input type="text" name="prod" required placeholder="Production"></li>      <li><input type="textarea" name="syn" required placeholder="Synopsis"></li>      <li><input type="submit" name="add" value="Add"></li>      <li><a href="sol2.html">Home</a></li>      </ul>    

and here is the php code :

  if (isset($_REQUEST['ok']))   {       $xml= new DOMDocument("1.0","UTF-8");       $xml->load("Dbase.xml");       $root=$xml->getElementsByTagName("Database")->item(0);       $Movie=$xml->createElement("Movie");       $title=$xml->createElement("Title","$_REQUEST['title']");       $cast=$xml->createElement("Cast","$_REQUEST['cast']");       $dir=$xml->createElement("Director","$_REQUEST['director']");       $prod=$xml->createElement("Producer","$_REQUEST['prod']");       $syn=$xml->createElement("Synopsis","$_REQUEST['syn']");       $Movie->appendChild("$title");       $Movie->appendChild("$cast");       $Movie->appendChild("$dir");       $Movie->appendChild("$prod");       $Movie->appendChild("$syn");       $root->appendChild("$Movie");       $xml->save("Dbase.xml");   }    

Here is a screenshot of what the result looks like

No comments:

Post a Comment