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

    Join Date
    Mar 2000
    Location
    Cape Town, South Africa
    Posts
    18
    Rep Power
    0
    Hi there

    I was wondering if there is a PHP function that will reset a form after it's been sumbitted so that the next entry can be made.

    I have a page called "add.php" which has a form used to insert info such as song name, artist, album, year, etc. into a MySQL table called "songs". I've got it to add the entered info from the form into the table - it works perfectly. The action of the form is set to the same page, ie. "add.php", but when I'm returned to the page after the data's been inserted, all the fields are still entered.

    What should I do to clear all the fields automatically so that I can immediately begin adding the next song? Is it possible, or do I have to have to refer to another page in the action to say something like "successfully added" and the redirect back to "add.php"?

    I'm still a PHP newbie, so any help would be grateful. Thanks so much!

    Warren
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    Hi,


    Write a small java script function for reset the form after submitting.

    or

    just call the HTML form portion after submitting the entries.

    Something like this.....
    <?
    if($submit){
    /* add record script goes here */
    ?>
    Thank You Record Has been added!

    Add more Record Here!!
    <form method="post" action="add.php3">

    </form>

    <? }else{
    ?>
    FILL THE FORM
    <form method="post" action="add.php3">

    </form>

    <?
    }
    ?>

  4. #3
  5. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Cape Town, South Africa
    Posts
    18
    Rep Power
    0
    Thanks for the help - I'll give it a try.

    Warren

Similar Threads

  1. Uploading Files
    By vivekjain in forum ASP Programming
    Replies: 0
    Last Post: February 16th, 2004, 11:21 PM
  2. Multiple emails in form submission
    By LBeans in forum ASP Programming
    Replies: 1
    Last Post: February 3rd, 2004, 07:18 PM
  3. reset single input field not form
    By darkane in forum HTML Programming
    Replies: 2
    Last Post: January 31st, 2004, 02:11 PM
  4. HTTP Error 400: Bad Request, with basic form
    By crackwombat in forum PHP Development
    Replies: 1
    Last Post: January 23rd, 2004, 06:40 PM
  5. Avoid form reset
    By latrixie in forum PHP Development
    Replies: 1
    Last Post: January 15th, 2004, 12:44 PM

IMN logo majestic logo threadwatch logo seochat tools logo