#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    0
    Rep Power
    0
    I've got a comment form with an action to itself, when i post a comment and refresh the form the comment is posted again (without typing it in the textarea) so $comments is not empty when i view the page again after i've posted a comment..

    same with $username, when i change the name in the username field, post something, it still shows the old name from the cookie, but when i close the window and look at the page again it shows the new username from the cookie..

    yes, that are 2 probs
  2. #2
  3. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    Okay, not sure I really follow here, but I'm going to take a shot at this.

    If after you "post" your form, the form is presented again.. and in your form "value=""" fields you have the
    echo of $value, then naturally PHP is going to re-populate those fields with the entered data.

    You can go about clearing this one of two ways:
    1) Remove the value attribute echos..
    2) Post the data to itself, and use and "if (submit)" method, so that only the "output" or "result" is present instead of the form.

    for example:

    <?php
    if ($submit) {
    //process my form, and give results
    }
    else {
    ?>
    Present my form for use
    <?php
    }
    ?>

    That way, your form and any field values are not displayed after the form is submitted.

    Clicking back in the browser will still show the data, of course, because in most cases the browser or server is caching the data.



    ------------------
    SnR Graphics,
    Low Cost Hosting and Web Development.

IMN logo majestic logo threadwatch logo seochat tools logo