Page refresh problem using PHP

  • lincy
  • Born
  • Born
  • No Avatar
  • Joined: Dec 19, 2008
  • Posts: 4
  • Status: Offline

Post December 19th, 2008, 10:42 pm

Hi All,
I am having form, where I need to make all the _POST data as null when the page is reloading..am using php code.

Thanks in Advance..
Cheers,
Lincy.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post December 19th, 2008, 10:42 pm

  • terrypearson
  • Born
  • Born
  • No Avatar
  • Joined: Dec 19, 2008
  • Posts: 1
  • Status: Offline

Post December 19th, 2008, 11:01 pm

Could you just do this:

Code: [ Select ]
$thispage = $_SERVER['HTTP_REFERER'];
header('Location: $thispage');
  1. $thispage = $_SERVER['HTTP_REFERER'];
  2. header('Location: $thispage');


This would technically redirect to the same page, but it would clear the post data.

One word of advice, the header must be defined before any HTML is written to the buffer.
  • lincy
  • Born
  • Born
  • No Avatar
  • Joined: Dec 19, 2008
  • Posts: 4
  • Status: Offline

Post December 19th, 2008, 11:07 pm

Hi,
Thanks in advance .i used

Code: [ Select ]
$thispage = $_SERVER['HTTP_REFERER'];
header('Location: $thispage');
  1. $thispage = $_SERVER['HTTP_REFERER'];
  2. header('Location: $thispage');


It redirect to the same page, but it wont clear the post data.
i have to remove all post data while i refresh the page
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post December 19th, 2008, 11:24 pm

What exactly are you trying to do ?

A "refresh" is instigated by the browser, you have no control over a refresh from PHP.
Strong with this one, the sudo is.
  • lincy
  • Born
  • Born
  • No Avatar
  • Joined: Dec 19, 2008
  • Posts: 4
  • Status: Offline

Post December 19th, 2008, 11:31 pm

Hi,
Thanks in advance .when ever i refreshed my page i need to set my postdatas values should be null
  • lincy
  • Born
  • Born
  • No Avatar
  • Joined: Dec 19, 2008
  • Posts: 4
  • Status: Offline

Post December 19th, 2008, 11:46 pm

This is the code iam using

Code: [ Select ]
<?php
    @session_start();

    if (((isset($_POST['submit']))&&($_POST["Verification_code"] )!= $_SESSION["security_code"] || $_SESSION["security_code"]=='') ) {
                            $Name             = $_POST['Name'];
        ?>
                        <td class="mandateroy">
                            *Please enter correct verification code.</td>
                        </tr>
            <?php
            }
            else
            {
                $p_Name              = $_POST['Name'];
                
            if(@mail($to, $subject, $message, $headers))
                                {
                                
                echo 'cc'.$_POST['submit_check'];
                $_SESSION["submit_check"]=1;
                session_write_close();
                $thispage = $_SERVER['HTTP_REFERER'];
                @header('Location: $thispage');
                }
                ?>
  1. <?php
  2.     @session_start();
  3.     if (((isset($_POST['submit']))&&($_POST["Verification_code"] )!= $_SESSION["security_code"] || $_SESSION["security_code"]=='') ) {
  4.                             $Name             = $_POST['Name'];
  5.         ?>
  6.                         <td class="mandateroy">
  7.                             *Please enter correct verification code.</td>
  8.                         </tr>
  9.             <?php
  10.             }
  11.             else
  12.             {
  13.                 $p_Name              = $_POST['Name'];
  14.                 
  15.             if(@mail($to, $subject, $message, $headers))
  16.                                 {
  17.                                 
  18.                 echo 'cc'.$_POST['submit_check'];
  19.                 $_SESSION["submit_check"]=1;
  20.                 session_write_close();
  21.                 $thispage = $_SERVER['HTTP_REFERER'];
  22.                 @header('Location: $thispage');
  23.                 }
  24.                 ?>


if the capcha verification code is incorrect it will go to the page and fill with pages. but iam submitting with sending email it will come to the page.after that if i refresh my page again the textboxes will fill up with post datas.I have to avoid filling the datas in refreshing the page

Thanks
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post December 20th, 2008, 12:22 am

I'm still not seeing the bigger picture here, or what you're trying to fix by clearing the POST data.

Is this thread of any help ?
http://www.issociate.de/board/post/1712 ... fresh.html
Strong with this one, the sudo is.

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 212 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.