Re: cleaning up the uri
| From: | Hugh Bothwell | Date: | Mon, 10 Sep 2001 01:48:02 +0000 |
| Subject: | Re: cleaning up the uri | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-66642@lists.php.net to get a copy of this message | ||
"Jon Thompson Coon" <jon.thompson@helsinki.fi> wrote in message
news:3B9C7858.4A7A55C0@helsinki.fi...
> I don't want to ask all these silly questions constantly time, but being
> lazy overcomes the urge not to do so.
>
> Having a page somethin/somewhere/index.php?do=this&and=that. This page
> does some updating and database queries. Hitting the reload button makes
> these things happen again (obviously). My question is, what are the
> usual ways of dealing with this problem?
>
> I don't want to separate my code into separe files, i.e. linking into a
> script that does the updating and redirects to the original page without
> the do=this&and=that part.
... so make the two pieces the same file... have the script redirect to
itself minus the parameters.
ie,
========= xyz.php ===========
<?php
if (isset(do)) {
do database stuff
header("Location: xyz.php?submitted=true");
}
else if (isset(submitted)) {
thanks for submitting
}
else {
show form
}
?>
==========================