Solved

HTTP_POST_VARS and refreshing page

Posted on 2003-12-02
6
397 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to create a scatter graph with straight lines 6 29
using php variable inside javascript 5 16
Scope of $_SESSION 17 31
php function to remove a file 31 18
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

863 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now