Example PRNFORM.PRT
#!proteus -z

; NULL input and output nulli; read with STDREAD, write to CONSOLE

; PRNFORM
;
; Program for Proteus
;
; (C) 1998-2004 Simone Zanella Productions
;
; CGI script sample: receive a form and returns an HTML page with field values.

; Under Ms-Dos™, the data sent are saved to a temporary file, because we need
; to know the exact size of returned data.

!ifdef MS_DOS

FUNCTION InitHTML()

  _P_F = TEMPNAME()
  _P_H = FOPEN(_P_F, 28)
RETURN

FUNCTION PrintHTML(s)

  FWRITE(_P_H, s)
RETURN

FUNCTION CloseHTML()

  CONSOLELN "Content-type: text/html"
  CONSOLELN "Content-length: " FSIZE(_P_H)
  CONSOLELN ""
  FSEEK(_P_H, 0, 0)
  REPEAT
    s = FREAD(_P_H, 1024)
    CONSOLE s
  UNTIL FEOF(_P_H)
  FCLOSE(_P_H)
  FREMOVE(_P_F)
RETURN

!else

FUNCTION InitHTML()

  CONSOLELN "Content-type: text/html"
  CONSOLELN ""
RETURN

FUNCTION PrintHTML(S)

  CONSOLE S
RETURN

FUNCTION CloseHTML()

RETURN

!endif

CONST SIGNATURE = "PRNForm 1.0"
CONST TITLE = "Form results"

QUERY = ""
REPEAT
  QUERY = QUERY STDREAD(1024)
UNTIL STDEOF()

A = URLDECODE(QUERY)

InitHTML()
PrintHTML("<html><head><title>" TITLE "</title></head><body><h1>" \
          TITLE "</h1><table border=\"3\" cellpadding=\"3\" width=\"100%\">" \
          CEOL)

AVLTRAVERSE(A, PrintForm)

FUNCTION PrintForm(field, value)

  PrintHTML("<tr><td><strong>" field "</strong></td><td><cite>" value \
            "</cite></td></tr>" _CEOL)
RETURN 0

PrintHTML("</table><br><br><strong>Converted by <cite>" SIGNATURE \
          "</cite></strong></body></html>" CEOL)

CloseHTML()

ABORT 0
Samples index Next example Previous example Contents Index
Midnight Lake iPhone Case Black Women Shoes Black Flat Shoes Leather Flats Black Patent Ballerinas Black Ballet Shoes Casual Shoes Black Shoes Women Balle Record Player Cufflinks Best iPhone XR Clear Cases iPhone XS/XS Max Leather Cases Sale Best iPhone 8/8 Plus Silicone Cases iPhone 7/7 Plus Cases & Screen Protector New Cases For iPhone 6/6 Plus iPhone 8 Case Sale iPhone Xr Case Online iPhone 7 Case UK Online iPhone X Case UK Sale iPhone X Case Deals iPhone Xs Case New Case For iPhone Xr UK Online Case For iPhone 8 UK Outlet Fashion Silver Cufflinks For Men Best Mens Cufflinks Outlet Online The Gold Cufflinks Shop Online Cheap Shirt Cufflinks On Sale Nice Wedding Cufflinks UK Online Top Black Cufflinks UK Online Mens Cufflinks Online Silver Cufflinks For Men Men Cufflinks UK Sale Gold Cufflinks UK Online Gold Cufflinks UK Silver Cufflinks UK Shirt Cufflinks Discount Online Mens Cufflinks Deals & Sales Girls Shoes For Dance Fashion Ballet Dance Shoes Best Ballet Flats Shoes UK Online Cheap Ballet Pointe Shoes UK Online Best Ballet Shoes Outlet Best Dance Shoes Sale Cheap Ballet Flats Sale UK Best Pointe Shoes Online UK Ballet Dance Shoes UK Shoes For Dance UK Best Ballet Slippers Shop Best Yoga Shoes Hotsell