Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2006
    Posts
    4

    Exclamation Unanswered: Want to track which link was clicked!

    I have a main page with 4 links to the same page "template".
    Depending on what link was clicked I am going to populate that page with the image and data for that link title.

    ---Golf Irons-----
    "<a href='cart.php?click='".$item['id']." -- does not seem to work

    ---Other crap----
    $click = 2

    ON new page
    $click = $_GET['click'];

    if $click == 1
    load golf irons image and description
    echo = "click: ".
    <------- $click is always zero ???
    if $click == 2
    load other crap

    ??????
    Last edited by Sabre3487; 07-19-06 at 20:38.

  2. #2
    Join Date
    Apr 2006
    Location
    Denver, Co. USA
    Posts
    242
    In the first file, there is a single-quote after the click= "<a href='cart.php?click=' The correct syntax for this is -
    PHP Code:
    echo "<a href='cart.php?click=".$item['id']."'>click here</a>";
    // or more simply -
    echo "<a href='cart.php?click={$item['id']}'>click here</a>"

  3. #3
    Join Date
    Jul 2006
    Posts
    4

    Thanks!

    WOW, isn't that just the way it is, one little thing.

    Thanks.

    <?php
    $cnt=1;
    while($cnt < 6)
    {
    $item = $products[$cnt];
    echo"<tr><td width='165' height='40'>";
    echo "<a href=cart.php?click=".$cnt." class='navText'>".$item['link']."";
    echo"</td><tr/>";
    $cnt++;
    }
    ?>

    Works like a charm!

Posting Permissions

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