Solved

HTTP_POST_VARS and refreshing page

Posted on 2003-12-02
6
403 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
  • 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
Industry Leaders: 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Wordpress Security 29 71
issue with DB import 1 36
pass foreach data in php into jquery ajax 10 45
Session time out quickly. 6 23
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

735 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