By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,377 Members | 1,690 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,377 IT Pros & Developers. It's quick & easy.

count by click problem

P: 25
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:

Expand|Select|Wrap|Line Numbers
  1. <form action="test.php" method="get">
  2. <input name="threadid" type="hidden" value="$thread[threadid]" />
  3. <input name="url_link" type="hidden" value="$thread[field17]" />
  4. <input name="blog_views" type="hidden" value="$thread[blog_views]" />
  5.  <a href="test.php?id=$thread[threadid]">$thread[threadtitle]</a> 
  6. </form>
test.php:

Expand|Select|Wrap|Line Numbers
  1. include("db.inc");
  2.     $url_link = $_POST['url_link'];
  3.     $threadid = $_POST['threadid'];
  4.     $blog_views = $_POST['blog_views'];
  5.  
  6.  
  7. $query = "UPDATE thread SET blog_views = blog_views + 1 WHERE threadid  = '$threadid' ";
  8.  
  9. if (!mysql_query($query))
  10. {
  11. echo "<script language=javascript>alert('Data failed to be update');</script>";
  12. }
  13. else {
  14. echo "<script language=javascript>alert('Data has been update successfully');</script>";
  15. }
  16. echo"<script>window.navigate('$url_link')</script>";
May 3 '10 #1
Share this Question
Share on Google+
1 Reply


P: 61
The form method is 'get' and you take values from $_POST.;)
May 3 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.