stripping a get variable out of url string
| From: | Steve B. | Date: | Sat, 05 Jul 2003 18:10:17 +0000 |
| Subject: | stripping a get variable out of url string | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-29093@lists.php.net to get a copy of this message | ||
I have an online tutorial build into a web page.
It has button next step.
If you are on page index.php?abc=123 for instance
the code is smart enough to make it index.php?abc=123&step=x
The problem is how to remove step=x from the old url string so that steps don't pile up.
index.php?abc=123&step=1&step=2
I'm trying ereg but could use a nudge with the wild card aspect of searching and replacing.
The code below builds the get string.
$stepnum = $_GET["step"];
$laststep=$stepnum-1;
$nextstep=$stepnum+1;
$args = $_SERVER["REQUEST_URI"];
if ($_SERVER["argc"]>0) $args.="&";
else $args.="?";
if ($stepnum>1)
{
echo "<br><a href='$args";
echo "step=1'>step 1</a><br>";
}
if ($laststep>0)
{
echo "<br><a href='$args";
echo "step=$laststep'>backup 1 step</a><br>";
}
echo "<br><a href='$args";
echo "step=$nextstep'>next step</a><br>";
thx
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com