132591 0 Posted October 22, 2006 Report Share Posted October 22, 2006 Is it possible to use a php form to edit xml? I was thinking something like this. <html><head><title>xml editor</title></head><body><form method="post"><input type="text" name="xml_code" /><input type="submit" value="change xml file" /></form><?php$fp = fopen("edited.xml", "w");fwrite($fp, $_POST['xml_code']);?></body></html> Quote Link to post Share on other sites
jhecht 0 Posted October 22, 2006 Report Share Posted October 22, 2006 very very close, but wrong;you might want to do it like this: <form action="otherPage.php" method="post"><textarea name="text"></textarea><br/><input type="submit" value="submit" name="submit"/></form> otherPage.php is as followed: <?phpif(isset($_POST['text'])){ $file = file_get_contents("edited.xml") or die("could not open edited.xml"); $file .= $_POST['text']; file_put_contents("edited.xml",$file) or die("Could not write to file");}else{ echo "you have come here not of how you are suppposed to... go the ###### away";]?> Quote Link to post Share on other sites
132591 0 Posted October 23, 2006 Author Report Share Posted October 23, 2006 Thanks, I would not have thought of that! Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.