A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: guestbook problem

  1. #1
    Member
    Join Date
    Feb 2004
    Posts
    53

    guestbook problem

    I have setup my guest book and it works perfectly... BUT I want it so that when people post an entry it comes on top, and the older ones stay on the bottom, becuase right now when someone posts and entry it goes at the very bottom and the oldest entry stays ontop. It is php and its posting it to a txt file... and ideas?

  2. #2
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    In the PHP file there should be a line somewhat similar to this:
    PHP Code:
    $data_to_write=fopen("file.txt""a"); 
    Try changing it to
    PHP Code:
    $data_to_write=fopen("file.txt""r+"); 
    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

  3. #3
    Member
    Join Date
    Feb 2004
    Posts
    53
    Here is my php, I changed it to the r+ that you said but now it completely doesnt work

    <?
    if (!isset($name) || !isset($email) || !isset($message) || empty($name) || empty($email) || empty($message)) {
    print "&result=Fail";
    print "&errorMsg=" . urlencode("Input required for all fields.");
    exit;
    }

    $email = strtolower($email);

    addentry($name, $email, $message);

    function addentry($name, $email, $message) {



    $message = stripslashes($message);

    $file = fopen('entry.txt', 'r+');

    if (!$file) {
    print "&result=Fail";
    print "&errorMsg=" . urlencode("Could not open entry.txt file. Change CHMOD levels to 766.");
    exit;
    }

    fputs($file,

    "-----
    Name:$name
    Email:$email
    Message:$message
    ");

  4. #4
    Member
    Join Date
    Feb 2004
    Posts
    53
    anyone else?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center