i need some help with this counter i'm creating.
it is supposed to be a counter that that increment every time the form on the page is submited.
eg: this form has been submitted ** times
and hel would be appreciated
Need some help with a Counter for a form
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
This is my counter script below...but it is getting it to increment when the form submits and view it on the same page
<?
$counter_file = "/../../count.txt";
$counter_file_line = file($counter_file);
$counter_file_line[0]++;
// opends the file and then writes the new number and then closes it
$cf = fopen($counter_file, "w");
fputs($cf, "$counter_file_line[0]");
fclose($cf);
// prints out the full count
echo $counter_file_line[0];
?>
Do i call the script in the form tag action="counter.php" ?
<?
$counter_file = "/../../count.txt";
$counter_file_line = file($counter_file);
$counter_file_line[0]++;
// opends the file and then writes the new number and then closes it
$cf = fopen($counter_file, "w");
fputs($cf, "$counter_file_line[0]");
fclose($cf);
// prints out the full count
echo $counter_file_line[0];
?>
Do i call the script in the form tag action="counter.php" ?
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK