Link to home
Start Free TrialLog in
Avatar of hasozduru
hasozduru

asked on

Page has Expired

Dear Experts

When I use post to process the form, if I click back button of the browser, browser gives me "Page has Expired" error and it asks me to refresh the page. I don't want to use get method. What would be the other ways to do it without getting that error?

Kind regards
ASKER CERTIFIED SOLUTION
Avatar of arantius
arantius

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hasozduru
hasozduru

ASKER

You mean all the professional web sites doing in this way?
I can't say for sure.  That's how I do it, and I don't believe there's a better way to acheive that particular effect.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I am trying a different method like following but it doesn't work. It says Fatal error: Call to undefined function: tep_draw_form() What can be the reason? Will it say Page has Expired if I use this code?

Thanks


function tep_draw_form($action, $method) {
    //$form = '<form action="' . ($action) . '" method="' . ($method) . '">';
    $form = '<form action=' . $action . '" method="' . $method . '">';

   
    return $form;
  }

echo tep_draw_form('baskets2.php','post');

Is the function in the same page ? Do you get Fatal error always or only if back button is pressed?

you miss a double-quote in the form action. It could also be written as:

<?php
function tep_draw_form($action, $method) {
    $form = "<form action='$action' method='$method'>";  
    return $form;
}
echo tep_draw_form('baskets2.php', 'post');
?>
Yes the function is in the same page. I get Fatal error when I load the page (without pressing back button). I changed it to your code but it still giving same error.
what is the output of:

<?php
function tep_draw_form($action, $method) {
    $form = "<form action='$action' method='$method'>";  
    return $form;
}
$my_functions = get_defined_functions();
print_r($my_functions['user']);
?>
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The same problem is answered in Java at : http://www.javaworld.com/javaworld/jw-09-2004/jw-0927-logout.html

It deals mainly with Log out as it is using Sessions to track a user. However, you'll still get the question about resubmitting post data: this is a feature of the client.

Ldbkutty's answer is probably the most straight forward approach