Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Help with <a href

Options

Comments

  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    Are you using & in the parameters, not just & on its own?


  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    warrenaldo wrote: »
    My problem is when i click the further link - it says:
    www.example.com?married=true

    Its overwriting my curent params.

    It's not "overwriting" any current params; the current params apply to the current page, and any links on that page that you want to "pass on" those params to another page need to do exactly that.

    Alternatively, you can set those params in session variables.


  • Registered Users Posts: 500 ✭✭✭warrenaldo


    Im not using session variables.

    But i think im a bit clearer now.

    I need to use Javascript - I dont know what order the user will click the params
    type=male&married=true
    or
    married=true&type=male
    So i cant pre-define the url.

    I am always redirecting them back to the one page and changing content based on the url.


  • Registered Users Posts: 67 ✭✭Mick Regan


    Not sure if i'm interpreting the prob correctly (should'nt be any difficulty passing multiple variables in the URL), but if you've got the option to use PHP here you could use a 'get' on the receiving page (even if it's the same page), eg:

    <?php
    if (isset($_GET))
    {$male = ($_GET);}

    if (isset($_GET))
    {$married = ($_GET);}
    ?>

    and if you need to pass back to javascript, something like this might do it:

    <script language="javascript" type="text/javascript">
    var $param1 = <?php echo $male ?>";
    var $param2 = <?php echo $married ?>";
    </script>

    Might be other/better ways, but just a thought.


  • Closed Accounts Posts: 18,163 ✭✭✭✭Liam Byrne


    warrenaldo wrote: »
    I dont know what order the user will click the params type=male&married=true or married=true&type=male

    So i cant pre-define the url.

    The order doesn't matter as long as both are set when required.

    Simple version (piggybacking on jQuery):

    $("#sexListname a").each(function() {
    thisLink=this.attr("href").split("?")[1];
    thisPage=document.location.href;
    if (thisPage.indexOf(thisLink)==-1) this.attr("href",thisPage+"&"+thisLink);
    });

    Needs extra work to be robust, but might help get you started.


  • Advertisement
  • Registered Users Posts: 500 ✭✭✭warrenaldo


    Liam,

    Ye that looks like what i need - it will get me started anyway.

    Thanks for the help guys.


Advertisement