I have 2 boxes that i want to be able to minimize and maximize. Because there are two of them, i used $REQUEST_URI to prevent one from opening when the other is closed. It works, but i get something like this in the URL "&left=false&left=true&right=false&left=false&left=true"
How do prevent this from happening? Every time you click on either button, instead of replacing the variable, it just its it to the end of the URL.

I use the following code (for the right box) if it helps any.

<?php 
if ($right == "false") {
echo ("<a href=\"$REQUEST_URI&right=true\"><img src=\"img/topic_open.bmp\" border=0 width=7 height=7></a>");
} else {
echo ("<a href=\"$REQUEST_URI&right=false\"><img src=\"img/topic_close.bmp\" border=0 width=7 height=7></a>");
} ?>

The easiest way to explain is just to see my problem in action, click on the close box to the right of "Latest on UnionDead".

http://www.uniondead.com/

    The way I'd do it is by parsing the query string, and then rebuilding it. So e.g.

    1. Make $_SERVER['QUERY_STRING'] into an associative array
    2. Set $array['right'] = true; (or left to true, or whatever value). This will overwrite the setting in the query string.
    3. Rebuild the query string by using a for each loop.
    4. The link would become $_SERVER['PHP_SELF'] . '?' . $rebuiltQueryString

    Diego

      Write a Reply...