SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    247
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question about isset()

    hey guys,

    I have a form. When it's submitted it posts to itself and then the page checks to see if the form has been set by using the isset() function. There's a problem however.

    As I've gone through the process of debugging, I've noticed this. Initially, the form is sent, everything works. However, if I REFRESH the page after I've sent the form, it re-executes the operation for the form.

    So this is what happens.

    I Submit the Form
    if (isset($_POST['submit']) echo "HELLO WORLD"
    OUTPUT = "HELLO WORLD"

    Now I refresh the page

    OUTPUT = "HELLO WORLD HELLO WORLD"

    Refresh Again

    OUTPUT = "HELLO WORLD HELLO WORLD HELLO WORLD"

    and it continues.

    Is there a way to unset the form after the operation is performed? I've tried unset($_POST['submit]) , but it does nothing.

    It seems that when I refresh the page it doesn't reset the isset, but keeps it the same.

    Any answers.

    Thanks guys.

  2. #2
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    247
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nevermind I got it.

    SOLUTION:

    After the operation was executed, I needed to redirect the page back to itself with the header() function. However, I had to use location and now refresh.


Bookmarks

Posting Permissions

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