0

I print some text after my CGI script finishes. As I understand the following line is compulsory:

 print('Content-type: text/html\n\n')

apparently for the server to know that it must output HTML?

However, what solution would you suggest to make it invisible on the output page?

even if after that print i add:

print("<HTML>")
...
print("</HTML>")

the content type is printed after the html tag like regular text

EDIT. full code:

#!/usr/bin/python3
import cgi
import cgitb
import sys
import subprocess
import os
import threading
import myModule

cgitb.enable()
form = cgi.FieldStorage()
a1= form['a1'].value
a2=form['a2'].value
a3=form['a3'].value


print('Content-type: text/html\n\n')
print('<html><head></head><body>')

pid=os.fork()
if(pid==0):
    print('<div align="center" > <br/><br/><br/><br/><h1>')
    infoMsg=myModule.myFun(a1,a2,a3)
    print('</h1></div></body></html>')
else:
    exit()
John Doe
  • 83
  • 1
  • 12
  • It is a head, it is *not* visible on the output page. If it's appearing, you are doing something strange, but without seeing your actual code we can't tell what. – Daniel Roseman Aug 07 '18 at 15:42
  • unfortunately it is visible,. Ok sure, i edited my question and added the full code – John Doe Aug 07 '18 at 16:36
  • What are you trying to hide? I didn't quite get your question. – Ahmad Bilal Aug 10 '18 at 00:45
  • Did you find out why? [Someone else](https://stackoverflow.com/questions/64888172/how-to-make-content-type-text-html-not-to-be-displayed-in-output) has the same problem – mplungjan Nov 18 '20 at 06:39

0 Answers0