The cgi I'm using is intended to generate an html page and output it to the inquirer's browser on the fly. I want to immediately display the search results but I want to open my template (to write to it and save as a different file. Then open the new file and display it. I haven't been able to get the SQL results to write to that file. They are simply displayed on my browser. Historically I have been able to create an array of files contained in a directory, for instance, and have the elements printed on a contents template. How do I get the SQL results and not have them displayed immediately?