Solved

HTTP_POST_VARS and refreshing page

Posted on 2003-12-02
6
406 Views
Last Modified: 2008-03-06
Is there a way to capture POST values if the refresh button is pressed?

sorry for the low points, all I have
0
Comment
Question by:zanner
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 6

Expert Comment

by:aolXFT
ID: 9859727
Usually the Browser will ask the user wants to resend the POST variables.

If not, then you could store them in a session, and retrieve them from the session later.
0
 
LVL 1

Expert Comment

by:Snyke
ID: 9860364
I think sessions are the easiest way to do it.
Or if the values aren't so much you could use cookies, but all this relies on the fact that the user accepts cookies (since even Sessions use cookies if not used through the URI).
0
 
LVL 6

Expert Comment

by:aolXFT
ID: 9860485
Well with Sessions you can transmit the id with --enable-trans-id through GET or POST links. Having that said that would be using the solution to solve your problem without actually coming up with the solution(or something like that).

I think we need more information before we can make any real suggestions regarding the circumstances surrounding the situation.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:zanner
ID: 9861232
attempting to use session variable

this is what i want to accomplish

// top of page

session_start();

if ($_SESSION["state"] != "true") {
     $_SESSION["state"] = "false";
     session_register('state');
}

// assign new value if db query successful

$_SESSION["state"] = "true";
session_register('state');

// test if db query not successful

if ($_SESSION["state"] == "true") {
     do stuff
} else {
     do other stuff
}

this is all done on one page

thanks!


0
 
LVL 6

Expert Comment

by:aolXFT
ID: 9861327
You don't have to use session_register if you are using the $_SESSION array.
0
 
LVL 1

Accepted Solution

by:
Snyke earned 30 total points
ID: 9861784
How about using this:

<?php
  foreach($_POST as $key => $value)
    $_SESSION["posted_".$key] = $value; //the prefix is just to be sure no important variable is overwritten.
?>
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question