Results 1 to 4 of 4

Thread: How to pass div id and querystring through anchor tag link

Hybrid View

  1. #1
    Join Date
    Jul 2012

    How to pass div id and querystring through anchor tag link

    When i click on link i have to show div.I am sending div id and query string value through anchor tag link.But,i am not getting the query string value.This is my code

    <a href="#cart?product_name=<?php echo $row['product_name'];?>"></a>
    <div id="cart">
    echo $_GET['product_name'];

  2. #2
    Join Date
    May 2003
    In your qry string your using "$row['product_name']" and in the display your using "$_GET['product_name']". Which one isnt displaying? if the $row isnt showing, you need to post the code that is retrieving the "$row".
    We do precision guesswork

  3. #3
    Join Date
    Jul 2012
    The value is coming dynamically.

  4. #4
    Join Date
    Mar 2011
    The problem is that browsers won't reload a page when the user clicks on a link that begins with a named anchor (ie. <a href="#cart">). So no interaction with your query string ever occurs anywhere - either locally or on the server. You could try:
    <a href="<?php echo($_SERVER[PHP_SELF]); ?>?product_name=MyProduct">
    which would reload the page from the server with a proper query string, but I don't think you can mix a query string with a named anchor - at least not reliably across browsers.
    Rick Trethewey
    Rainbo Design

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center