The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

I'm not sure exactly what you're trying to do, but it sounds like you don't want the variable to restart at zero everytime the function is called? If so, you could store it in a hidden form field, since it looks like you're using a form anyway. When the function is called again, retrieve the hidden value and do as you please with it.

The only reason I have the count routine in my script is to toggle on and off the $string variable, which will always remain the same (00/00/0000).

Code:

$count is initially set to zero.
When the user clicks the checkbox {
$count = $count + 1;
if $count%2 == 0 {
'00/00/0000' will appear in the textbox
} else if $count%2 == 1 {
textbox is cleared, or given a value of '';
}
}