Re: stripping a get variable out of url string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If all else fails, split on the &.

$url = split("&", $_SERVER["REQUEST_URI"]);
$args = $url[0];

Cheers,
~Steve

Steve B. wrote:

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






-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux