SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Guru arunkumar's Avatar
    Join Date
    Jan 2005
    Location
    India:Chennai
    Posts
    827
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to clear all the post variable

    Sir,

    i am sending a form via post method and after that i am reloading then same page when i reload the same page the POST varibles i set previously is live there i want to empty in how to do it..
    Where there is a will there is a way
    ArunKumar

  2. #2
    Tranceoholic lilleman's Avatar
    Join Date
    Feb 2004
    Location
    ÷rebro, Sweden
    Posts
    2,716
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    When you're done with the information that the user entered in the form, you can reload the page using header('Location: filename.php'); to discard all sent information. Just remember that you can't have any output (text, HTML, spaces, etc.) before calling header.
    ERIK RIKLUND :: Yes, I've been gone quite a while.

  3. #3
    SitePoint Guru arunkumar's Avatar
    Join Date
    Jan 2005
    Location
    India:Chennai
    Posts
    827
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no lileman i am checking a condition and if it is done i am inserting into that database .if not i am not entering and loding the page with the data.if suppose if the condition satisfies the data is inserted and the valiue in POST is assigned and the form get the old value which is not to be i want the POST data to empty.

    that when i print by print_r($_POST) all the variable are set i want alll the variable to unset to empty value how can i
    Where there is a will there is a way
    ArunKumar

  4. #4
    Tranceoholic lilleman's Avatar
    Join Date
    Feb 2004
    Location
    ÷rebro, Sweden
    Posts
    2,716
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Well, from what you explained above, the method I suggested should work just fine. Reload the page after you've inserted the data into the database, and your form will be empty as you want it to be.
    ERIK RIKLUND :: Yes, I've been gone quite a while.

  5. #5
    SitePoint Guru arunkumar's Avatar
    Join Date
    Jan 2005
    Location
    India:Chennai
    Posts
    827
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Lilleman

    here if my mere sample of my code

    if($i==0)
    include "insert.php";
    else
    the html code

    here in insert.php i am inserting and if i!=0 that ifs fine all the post data is there in the html page if it is inserted to database i want the postvariab;e to erased how can i do lilleman
    Where there is a will there is a way
    ArunKumar

  6. #6
    Tranceoholic lilleman's Avatar
    Join Date
    Feb 2004
    Location
    ÷rebro, Sweden
    Posts
    2,716
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I think that something like this should work:

    PHP Code:
    if( $i == )
    {
      include 
    'insert.php';
      
    header('Location: filename.php');
      
      
    // the line above will reload the page. just remember to
      // replace 'filename.php' with the name of your script.
    }
    else
    {
      
    // your HTML code here

    ERIK RIKLUND :: Yes, I've been gone quite a while.

  7. #7
    SitePoint Guru arunkumar's Avatar
    Join Date
    Jan 2005
    Location
    India:Chennai
    Posts
    827
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that,s fine lilleman,,,,

    here after inserting i am making the html code diplayed after the unsert operation done

    if( $i == 0 )
    {
    include 'insert.php';
    header('Location: filename.php');

    // the line above will reload the page. just remember to
    // replace 'filename.php' with the name of your script.
    }
    else
    {
    // your HTML code here
    }

    here the else loop will not come soory for that ..then why do to out header there
    Where there is a will there is a way
    ArunKumar


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
  •