Help need in CGI script

Hello All,

first of all please forgive me if I have brocken some rule of this forum and this is not a homework :).

Could you please help me as I have created a new apache service in a server by creating a new httpd.conf for the new service. Now in the httpd.conf file I have studied by google and tried to put the values correct for configuration like I have put Document root , Alias , Listen and Script Alias etc and I am able to hit the link successfully, but when I have put a simple cgi script(which is nothing but a simple html code) in the same link and in spite of reading echo, !#/usr/ksh commands it is simply putting echo in IE.

What I think is it is taking file as a text file, could you please let me know how I can fix this.

Here is the CGI.

#!/usr/bin/ksh
echo "Content-Type: text/html"
echo "<HTML>"
echo "<HEAD>"
echo "<TITLE>Singh test</TITLE>"
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">"
echo "<SCRIPT TYPE=\"text/javascript\">"
echo "<!--"
echo "window.focus();"
echo "//-->"
echo "</SCRIPT>"
echo "</HEAD>"
echo "<BODY>"
echo "</HEAD>"
echo "<BODY  TEXT vlink="black" link="blue" alink="white" >"
echo "<CENTER><STRONG> status form</STRONG></CENTER>"
echo "<FORM METHOD=POST ACTION=/opt/hd/test/test.cgi>"
echo "</FORM>"
echo "</BODY>"
echo "</HTML>"
 

Thanks,
R. Singh

try adding:

echo ""

after Content-type line

Thank you rdrtx1 but it is not working. I am still getting below in IE.

#!/usr/bin/ksh echo "Content-Type: text/html" echo "" echo "" echo "" echo "" echo "" echo " " echo "" echo "" echo "" echo "" echo " 
Singh test" echo " " echo "" echo "" echo "" 

Thanks,
R. Singh

The body text line was not properly quoted. Instead of using echo and quotes, can't you do something like (not tested):

#!/usr/bin/ksh

/bin/cat << EOF
Content-Type: text/html

<HTML>
<HEAD>
<TITLE>Singh test</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT TYPE="text/javascript">
<!--
window.focus();
//-->
</SCRIPT>
</HEAD>
<BODY>
</HEAD>
<BODY TEXT vlink="black" link="blue" alink="white" >
<CENTER><STRONG> status form</STRONG></CENTER>
<FORM METHOD=POST ACTION=/opt/hd/test/test.cgi>
</FORM>
</BODY>
</HTML>
EOF