in reply to Opening files problem

Your open command is failing therefore executing the else portion of the code. Are you sure data.txt exists and exists in whatever directory your cgi script is running in?

-- vek --