Sorry for the confusing initial request.
You were correct in assuming that I am generating URLs like:
page.php?foo1=bar1&foo2=bar2&foo1=bar3&foo2=bar4

So I suppose the consise follow-up question is how can I get a hyperlink to
change one of those varibles in the string.

In the past I have just tacked a varible on to the end of the string, but I
don't want to be redundant.

Thanks again.


"Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> --- "Jed R. Brubaker" <[EMAIL PROTECTED]> wrote:
> > I am trying to make a page navigation menu (we have all seen them,
> > "Page: 1 2 3..."), and I would like to continue doing this via the
> > URL variables. Right now, each of the page numbers is a hyper link
> > is set like this:
> >
> > "page.php?".$_SERVER["QUERY_STRING"]."&more variables here."
> >
> > The problem, however, is that those variables are a string. If the
> > variables that the menu defines are already in the string, it
> > doesn't update them, it just adds more definitions to the URL.
>
> I had a hard time interpreting your question, but I think you're saying
> that you are generating URLs like this:
>
> /page.php?foo1=bar1&foo2=bar2&foo1=bar3&foo2=bar4
>
> And, you're wanting to not duplicate variables in your URL, correct?
>
> You could always keep your query string in an array or something. This
> would allow you to update values in the array prior to the end of your
> script. You can start this array using $_GET:
>
> $query = $_GET;
>
> Of course, you might want to rather filter this data on each page, so that
> you don't spread tainted data more than necessary. Regardless, this will
> allow you to update values in your query string. If you want to update
> foo1, you don't have to care whether it's already set:
>
> $query['foo1'] = 'newvalue';
>
> Hope that helps.
>
> Chris
>
> =====
> Chris Shiflett - http://shiflett.org/
>
> PHP Security Handbook
>      Coming mid-2004
> HTTP Developer's Handbook
>      http://httphandbook.org/
> RAMP Training Courses
>      http://www.nyphp.org/ramp

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

Reply via email to