click a hyperlink to query MYSQL w/PHP - how?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • leegold2

    click a hyperlink to query MYSQL w/PHP - how?

    Like so many questions this involves MYSQL and the PHP (or Perl) layer.

    I'm going to have html in text fields and there's going to be what
    normally would be an internal link to another place in the same
    document. But in this case,
    Code:

    <a href="#futherdo wn">next title</a>

    is not in the html document. When a user clicks this link I want to
    query the DB and append/render the queried record on the I guess
    existing (refreshed) page. What's a strategy to make a hyperlink query
    via PHP?

    I'm trying to make internal links work "normally" on dynamic page if you
    get my drift,
    Lee G.
  • Daniel Tryba

    #2
    Re: click a hyperlink to query MYSQL w/PHP - how?

    leegold2 <leegold@nospam .net> wrote:[color=blue]
    > <a href="#futherdo wn">next title</a>
    >
    > is not in the html document. When a user clicks this link I want to
    > query the DB and append/render the queried record on the I guess
    > existing (refreshed) page. What's a strategy to make a hyperlink query
    > via PHP?
    >
    > I'm trying to make internal links work "normally" on dynamic page if you
    > get my drift,[/color]

    This is a clientside issue, so you need clientside tech to accomplish
    what you want. The above link in that form is quite useless, use
    javascript instead. The main problem is that if the anchor is within the
    current URL the browser will not make a request to the server.

    --

    Daniel Tryba

    Comment

    • Chris Hope

      #3
      Re: click a hyperlink to query MYSQL w/PHP - how?

      leegold2 wrote:
      [color=blue]
      > Like so many questions this involves MYSQL and the PHP (or Perl) layer.
      >
      > I'm going to have html in text fields and there's going to be what
      > normally would be an internal link to another place in the same
      > document. But in this case,
      > Code:
      >
      > <a href="#futherdo wn">next title</a>
      >
      > is not in the html document. When a user clicks this link I want to
      > query the DB and append/render the queried record on the I guess
      > existing (refreshed) page. What's a strategy to make a hyperlink query
      > via PHP?
      >
      > I'm trying to make internal links work "normally" on dynamic page if you
      > get my drift,[/color]

      You cannot make internal #furtherdown type links on an HTML page do anything
      other than move up and down a page which has already been rendered in the
      browser.

      You need to make a link back to the server, in your case back to the same
      page, passing parameters which will get that information into the page eg
      foo.php?show=3# section3 - the use of the #section3 bit here is to then jump
      the browser down to the appropriate section once the page has loaded.

      Another way to do this is a combination of Javascript and CSS (ie DHTML).
      You have have all the required content in your page but hidden, and when
      they click a link it makes the section you want appear. Of course this
      won't work if they have Javascript disabled, or a using a browser that does
      not support JS.

      An example of this in action is at


      Click the little down arrow links to the left of the questions and the
      answer appears underneath. Click it again and it disappears.

      If the above link is broken in your newsreader use this tinyurl instead


      --
      Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/

      Comment

      • leegold2

        #4
        Re: click a hyperlink to query MYSQL w/PHP - how?

        Chris Hope wrote:[color=blue]
        > leegold2 wrote:
        >
        >[/color]
        ......snip...[color=blue]
        >
        > You cannot make internal #furtherdown type links on an HTML page do anything
        > other than move up and down a page which has already been rendered in the
        > browser.
        >
        > You need to make a link back to the server, in your case back to the same
        > page, passing parameters which will get that information into the page eg
        > foo.php?show=3# section3 - the use of the #section3 bit here is to then jump
        > the browser down to the appropriate section once the page has loaded.[/color]

        Yes, thanks. That's what I'm going to do. I just learned a lot!

        .....snip...

        Comment

        Working...