[Tutor] Hit Counter
alan.gauld@bt.com
alan.gauld@bt.com
Mon, 30 Jul 2001 10:32:01 +0100
Hmm cgi is not my strongest area but I'll hazard a guess...
> <form action="cgi-bin/counter.pyw">
> <input type="hidden" name="Stats" value="Hit Counter">
> </form>
> but I suspect this is where the problem is. Why doesn't the script
> run each time the page loads?
How is the form submitted? AFAIK the action will only
be activated by a submit?
I think you need some Javascript or something in there
to force the action.
Now just a quick comment on the script:
> x = int(Hits) + 1
> h = str(x)
> OutFile = open("count.dat", "w")
> OutFile.write(str(x))
you can miss out the
h=str(x)
line coz you dson't use h
or alternatively
Outfile.write(h)....
> print "<P><H2>Jon Cosby's web page - Total hits:</H2><br><br> "
> for i in h:
> print "<img src='images/" + i + "silver.gif'>"
No ALT tags - AAARGH! bad. bad.
But OK you use h here so in that case use h in the write()...
Alan g.