Page refresh problem using PHP

  • lincy
  • Born
  • Born
  • lincy
  • Posts: 4

Post 3+ Months Ago

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
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • terrypearson
  • Born
  • Born
  • terrypearson
  • Posts: 1

Post 3+ Months Ago

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
  • lincy
  • Posts: 4

Post 3+ Months Ago

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
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

What exactly are you trying to do ?

A "refresh" is instigated by the browser, you have no control over a refresh from PHP.
  • lincy
  • Born
  • Born
  • lincy
  • Posts: 4

Post 3+ Months Ago

Hi,
Thanks in advance .when ever i refreshed my page i need to set my postdatas values should be null
  • lincy
  • Born
  • Born
  • lincy
  • Posts: 4

Post 3+ Months Ago

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
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13503
  • Loc: Florida

Post 3+ Months Ago

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

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 55 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.