not sure if I completely understand your issue, but I have a couple ideas.
For one, in scripts executable via the client's web browser, use "print" in lieu of "echo." The first line tells the browser what to expect:
print "Content-type: text/html\n\n";
You need the content-type declaration before printing anything else to the browser, and the two newlines at the end of it are required. For actual pages, you'll want the HTML tags, but many browsers will still display the text without the proper stuff in place. You can bunch it all into one print statement if you like:
print "Content-type: text/html\n\n
<html><head><title>This page is dynamic HTML!</title></head>
zedmelon sure is a swell guy ;)
Second, try relocating the file to your cgi-bin. I don't know if that's a universal requirement, but it makes sense from a security standpoint to compartmentalize script execution. All my HTML and web crap is completely self-taught, so with that in mind I just moved one of my scripts to another directory for grins, and my browser listed the file instead of executing it.
You should already have a cgi-bin, probably /var/www/cgi-bin, but if not, check to see if your httpd.conf mentions another place for a ScriptAlias:
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
If you have any virtual hosts running (if you don't know what that means, don't worry; you don't), then each virtual host has the potential for using a different cgi-bin, but still might not. If you're not running virtual hosts, that's the directory to use.
Also, "Location: <URL>" instead of the content type line will redirect to a new page, but it can't come after a content-type declaration.