RE: [PHP] Redirection and URL in Browser...
| From: | Craig Vincent | Date: | Thu, 03 Aug 2000 16:13:04 +0000 |
| Subject: | RE: [PHP] Redirection and URL in Browser... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-9968@lists.php.net to get a copy of this message | ||
> The problem:
> When the user presses "reload" on the browser, the product is added
> again, because the script add.php?product is called again. Any idea how
> to handle this ?
Why not simply have a page that handles all the cart additions but redirects
to another page with a 302 redirect....
ex.
app.php.product ->
<?
# Code to add product
header("Location: index.html"); #or whatever page you want the person to go
back to.
exit;
?>
Doing that....a reload will only reload whatever page the user is currently
at....and a click on the back button will take the user to the page PRIOR to
the product add (although the product should still be in the cart whether it
be via session, cookie, SQL, whatever).
Sincerely,
Craig Vincent
-------------------------
Senior Programmer
Jazzmonkey Media Inc.
http://www.jazzmonkey.com
-------------------------
>
>
> I tried to do the following: When pressing "buy" on a produkt, the
> script add.php?product is called, but it's making no output, instead I
> use Header("Location: show.php") to redirect to shop.php, which shows
> the cart.
>
> The problem:
> This works, but in the adress-bar, the browser still shows
> add.php?product. If the user presses "Reload", the product is added
> again...
>
> Any ideas ?
>
> Regards
>
> Martin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net