Paul
Paul

Reputation: 6176

edit text from/to an XML file : it works in localhost but not on internet? (php, xml)

i try to edit the text of an XML file from my page edit.php. It works fine if i test it in "localhost", the xml file is updated as expected.

But, when i put the files on internet, and i try to edit the text from there, it seems to be ok, but then i refresh the page, and the text in the edit.php is still the same as before, and nothing has been updated. Do you know where this comes from? is there a problem with my "form" ?

here is my code :

<body>

        <?php
        /* READ */
        $dom = new DomDocument();
        $dom->load('edition.xml');

        $_haut = $dom->getElementsByTagName('haut')->item(0);
        $haut = $_haut->firstChild->nodeValue;

        /* WRITE */
        if ( isset($_POST['cache']) ){
            $haut = stripslashes($_POST['haut']);
            $_haut->firstChild->nodeValue = $haut;

            $dom->save('edition.xml');
        }
        ?>

        <div>
            <h4 style="float:left;">Update the text</h4>
            <div style="clear:both;"></div>


            <form method="post" action="edition.php">
                <p>
                <label for="textarea1">the text : </label><br />
                <textarea rows="14" cols="80" name="haut" id="textarea1"><?php echo $haut ?></textarea>
                </p>
                <input type="hidden" id="cache" name="cache"/>
                <p><input type="submit" value="Envoyer" /></p>
            </form>


        </div>
</body>

Thanks for your help

Upvotes: 0

Views: 279

Answers (1)

dstarh
dstarh

Reputation: 5086

My best guess is the user php is running as does not have the permissions to do so.

Upvotes: 1

Related Questions