Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 671903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:25:29+00:00 2026-05-14T00:25:29+00:00

1st I have to say I know nothing bout php. I was actually doing

  • 0

1st I have to say I know nothing bout php. I was actually doing my AS3 guest-book and through parts of tutorials from Activetut, I managed to come out a flash guest-book. So the problem now I’m facing is the guest-book could only inject 1 XML data and it will always clear off the old 1, while the flash is still caching on the old XML files.

I’d found some other tutorials(which I think its quite hard since i dunno anything about php) and comparing to the php code I’m using, it seems to be extremely short. I have no idea what the code does, so currently I’m not sure whether the problems came from the php or my AS3.

 <?php
        if (isset($GLOBALS["HTTP_RAW_POST_DATA"])){
            $xml = $GLOBALS["HTTP_RAW_POST_DATA"];
            $file = fopen("wish.xml","wb");
            fwrite($file, $xml);
            fclose($file);
        }
    ?>

and below is my correct XML format:

<WISHES>
    <WISH>
        <NAME>Test</NAME>
        <EMAIL>test@tes.com</EMAIL>
        <DATENTIME>2/3/10</DATENTIME>
        <MESSAGE>Dummy Message</MESSAGE>
    </WISH>
<WISH>
        <NAME>Test</NAME>
        <EMAIL>test@tes.com</EMAIL>
        <DATENTIME>2/3/10</DATENTIME>
        <MESSAGE>Dummy Message</MESSAGE>
    </WISH>
</WISHES>

So anyone kind to explain what that php code does? cause it replace my XML with:

<WISH>
        <NAME>Test</NAME>
        <EMAIL>test@tes.com</EMAIL>
        <DATENTIME>2/3/10</DATENTIME>
        <MESSAGE>Dummy Message</MESSAGE>
    </WISH>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:25:29+00:00Added an answer on May 14, 2026 at 12:25 am

    As Michael and Nifle already stated, the code deletes the current entries in the xml file when storing a new entry. To overcome this problem and do, what you expected, amend the code this way:

    <?php
        if (isset($GLOBALS["HTTP_RAW_POST_DATA"])){
            $xml = $GLOBALS["HTTP_RAW_POST_DATA"];
    
            // read in the old ontent of the file
            $oldXML = join('', file('wish.xml'));
    
            // replace the old file ending with the new entry and a new file ending
            $newXML = str_replace('</WISHES>', $xml."\n</WISHES>");
    
            // finally store the new data to the file
            $file = fopen("wish.xml","w");
            fwrite($file, $newXML);
            fclose($file);
        }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say you have strings of this format. January 11th, 111 November 1st, 1101
Let us say I have a list such as : Foo : 1st chapter
Say I have a table with 3 columns, only the 1st and 3rd column
Say I have a service exposing two end points, 1st is a NetTCPBinding the
I want to know your thoughts in performance and memory. Let's say I have
Say I have a class: public class R { public static final int _1st
I have 1st popup, and this 1st popup opens 2nd popup Code: <view-state id=paneMaintenance
I have 2 tables: 1st holds employees (of ones in any position) and the
I have two Linux Machine,1st is machine X ,other is machine Y i want
I have 3 arrays like this: 1st Array ( [0695] => Array ( [loan_number]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.