?
Solved

HTTP_POST_VARS and refreshing page

Posted on 2003-12-02
6
Medium Priority
?
411 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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 90 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

649 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