View Full Version : Increasing counters

05-16-2011, 03:19 PM
I have the following ouput as part of a POST submit form. There are 3 types of users with own counters and submit button. I use the Username(session) and Line No to increase counter. How do I determine which line number a clicked button is on and how do I pass and access the Line number in $_POST? Counters 2 & 3 are also links to files containing name of users who clicked a certain button. In order to display the links(counters), I need identify the appropriate cell containing the counter by Line number and counter number. Should I id each counter like so id='".$LineNo."'Column' or is there a better way of going about this?

echo "<tr><td >".$LineNo."</td><td>".$Text."</td><td>Counter1</td><td>button1</td><td>Counter2</td><td>button2</td><td>Counter3</td><td><button3</td></tr>";

Hope this isn't too vague.

05-16-2011, 04:36 PM
You can't search an id for a selected line number. PHP is server side only, you need to send the line number back with a request in order to tell PHP about it. It hasn't a clue what you are talking about in regards to HTML (you cannot specify a relative location or respond to an onclick event).
You can tell which submit button was selected by providing them with unique names (or arrays should work I'd suspect since you can only provide it with one successful input value). That can then be used to determine which button was clicked (maybe that is on its own line), and you can go from there.

05-23-2011, 07:40 PM
When one of the buttons is clicked I can get the user type using the session username. I then check the the appropriate button with

I can then get the LineNo (first cell in row) using

The counter cell id is 'CellName{$row['LineNo']}'
I have created a txt file and a counter as a link to the file

$Link = "<a href='path/to/txt/file.txt'>{$counter}</a>";
Now what I want to do is insert the link, $Link into the counter cell. How do I go about this?