Appending #anchor with other variables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Pseud O'Nym

    #1

    Appending #anchor with other variables

    Hi all, and apologies if this is a newbie type question, I am one.

    I need to get a page to go to a paticular <a name=""> tag. It works fine
    with no variables passed eg: myscript.php#to p, but I need to append other
    info and just can't work out how to do it.

    TIA


  • Joe Molloy

    #2
    Re: Appending #anchor with other variables

    You could add your variables to the querystring like

    script.php#top? myvar=thevar&my var1=thevar2

    and then retrieve them on the script.php page using

    $myvar = $_GET["thevar"];

    $myvar1 = $_GET["thevar2"];

    Happy coding :)

    Joe
    "Pseud O'Nym" <notexpletivede leteduk@notyaho o.co.uk> wrote in message
    news:436ab59c$0 $27969$ed2619ec @ptn-nntp-reader02.plus.n et...[color=blue]
    > Hi all, and apologies if this is a newbie type question, I am one.
    >
    > I need to get a page to go to a paticular <a name=""> tag. It works fine
    > with no variables passed eg: myscript.php#to p, but I need to append other
    > info and just can't work out how to do it.
    >
    > TIA
    >
    >[/color]


    Comment

    • Pseud O'Nym

      #3
      Re: Appending #anchor with other variables


      "Joe Molloy" <molloy_joe@hot mail.com> wrote in message
      news:VTyaf.1816 7$R5.1764@news. indigo.ie...

      Thank you, I just looked at $_GET on php.net and now understand. :) OTOH, I
      think maybe I'll make a form with a POST method, and hidden inputs for my
      vars, in the places I now have hrefs with appended variables. The contents
      of the address bar for my, very simple, site is starting to make a Google
      look like child's play .
      [color=blue]
      > You could add your variables to the querystring like
      >
      > script.php#top? myvar=thevar&my var1=thevar2
      >
      > and then retrieve them on the script.php page using
      >
      > $myvar = $_GET["thevar"];
      >
      > $myvar1 = $_GET["thevar2"];
      >
      > Happy coding :)
      >
      > Joe
      > "Pseud O'Nym" <notexpletivede leteduk@notyaho o.co.uk> wrote in message
      > news:436ab59c$0 $27969$ed2619ec @ptn-nntp-reader02.plus.n et...[color=green]
      > > Hi all, and apologies if this is a newbie type question, I am one.
      > >
      > > I need to get a page to go to a paticular <a name=""> tag. It works fine
      > > with no variables passed eg: myscript.php#to p, but I need to append[/color][/color]
      other[color=blue][color=green]
      > > info and just can't work out how to do it.
      > >
      > > TIA
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Chuck Anderson

        #4
        Re: Appending #anchor with other variables

        Joe Molloy wrote:
        [color=blue]
        >Joe
        >"Pseud O'Nym" <notexpletivede leteduk@notyaho o.co.uk> wrote in message
        >news:436ab59c$ 0$27969$ed2619e c@ptn-nntp-reader02.plus.n et...
        >
        >[color=green]
        >>Hi all, and apologies if this is a newbie type question, I am one.
        >>
        >>I need to get a page to go to a paticular <a name=""> tag. It works fine
        >>with no variables passed eg: myscript.php#to p, but I need to append other
        >>info and just can't work out how to do it.
        >>
        >>TIA
        >>[/color]
        >You could add your variables to the querystring like
        >
        >script.php#top ?myvar=thevar&m yvar1=thevar2
        >
        >and then retrieve them on the script.php page using
        >
        >$myvar = $_GET["thevar"];
        >
        >$myvar1 = $_GET["thevar2"];
        >
        >Happy coding :)
        >[/color]
        It appears to be a moot point now for the OP (is going to use POST), but
        the fragment identifier (#top) should be at the end of the URI string -
        after the variables.

        script.php?myva r=thevar&myvar1 =thevar2#top

        --
        *************** **************
        Chuck Anderson • Boulder, CO

        Integrity is obvious.
        The lack of it is common.
        *************** **************

        Comment

        • Pseud O'Nym

          #5
          Re: Appending #anchor with other variables

          "Chuck Anderson" <websiteaddress @seemy.sig> wrote in message
          news:Qoidna9vgN cvXfbeRVn-oQ@comcast.com. ..
          wrote:[color=blue]
          > It appears to be a moot point now for the OP (is going to use POST), but
          > the fragment identifier (#top) should be at the end of the URI string -
          > after the variables.
          >
          > script.php?myva r=thevar&myvar1 =thevar2#top
          >[/color]

          I would still like to know how to get this to work, for future reference.

          I notice that the server on which the script is run, and which is outside my
          control, has register_global s set on. So I don't need to use $_GET to return
          appended variables, but could this be why the fragment identifier is being
          ignored?


          Comment

          • Pseud O'Nym

            #6
            Re: Appending #anchor with other variables

            "Pseud O'Nym" <notexpletivede leteduk@notyaho o.co.uk> wrote in message
            news:436ce6b7$0 $27975$ed2619ec @ptn-nntp-reader02.plus.n et...[color=blue]
            > "Chuck Anderson" <websiteaddress @seemy.sig> wrote in message
            > news:Qoidna9vgN cvXfbeRVn-oQ@comcast.com. ..
            > wrote:[color=green]
            > > It appears to be a moot point now for the OP (is going to use POST), but
            > > the fragment identifier (#top) should be at the end of the URI string -
            > > after the variables.
            > >
            > > script.php?myva r=thevar&myvar1 =thevar2#top
            > >[/color]
            >
            > I would still like to know how to get this to work, for future reference.
            >
            > I notice that the server on which the script is run, and which is outside[/color]
            my[color=blue]
            > control, has register_global s set on. So I don't need to use $_GET to[/color]
            return[color=blue]
            > appended variables, but could this be why the fragment identifier is being
            > ignored?[/color]

            Oops, sorry chaps! It does work as above, I had an if else back to front. :(


            Comment

            Working...