www.webdeveloper.com
Results 1 to 4 of 4

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

  1. #1
    Join Date
    Jul 2012
    Posts
    32

    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">
    <?php
    echo $_GET['product_name'];
    ?>
    </div>

  2. #2
    Join Date
    May 2003
    Posts
    599
    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".

  3. #3
    Join Date
    Jul 2012
    Posts
    32
    $row['product_name'];
    The value is coming dynamically.

  4. #4
    Join Date
    Mar 2011
    Posts
    1,156
    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:
    Code:
    <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.

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



Recent Articles