count by click problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amel86
    New Member
    • Apr 2010
    • 25

    count by click problem

    hello
    i need to count number of click for the link.
    but when i run my code, there's no function. the problem still the same. the count per click does not increase.

    here my code:

    html:

    Code:
    <form action="test.php" method="get">
    <input name="threadid" type="hidden" value="$thread[threadid]" />
    <input name="url_link" type="hidden" value="$thread[field17]" />
    <input name="blog_views" type="hidden" value="$thread[blog_views]" />
     <a href="test.php?id=$thread[threadid]">$thread[threadtitle]</a> 
    </form>
    test.php:

    Code:
    include("db.inc");
        $url_link = $_POST['url_link'];
        $threadid = $_POST['threadid'];
        $blog_views = $_POST['blog_views'];
    	
    
    $query = "UPDATE thread SET blog_views = blog_views + 1 WHERE threadid  = '$threadid' ";
    
    if (!mysql_query($query))
    {
    echo "<script language=javascript>alert('Data failed to be update');</script>";
    }
    else {
    echo "<script language=javascript>alert('Data has been update successfully');</script>";
    }
    echo"<script>window.navigate('$url_link')</script>";
    Last edited by Dormilich; May 3 '10, 08:01 AM. Reason: Please use [code] tags when posting code
  • shabinesh
    New Member
    • Jan 2007
    • 61

    #2
    The form method is 'get' and you take values from $_POST.;)

    Comment

    Working...