topical media & game development

talk show tell print

lib-ch-example-cgi-form1.ch / ch



  #!/bin/ch
  /* Copyright (c) 2001 by SoftIntegration, Inc. All Rights Reserved */
  
  /* Report in the form of plain text */
  include <cgi.h>
  
  int main() {
    int i, num;
    chstrarray name, value;
    class CResponse Response;
    class CRequest Request;
  
    Response.setContentType("text/plain");
    Response.begin();
    printf("CGI FORM test script reports:\n\n");
    num = Request.getFormNameValue(name, value);
    if(num == 0) {
      printf("No input from FORM\n");
      exit(0);
    }
    else if(num == -2) {
      printf("No enough memory<p>\n");
      exit(0);
    }
    printf("The following \%d name/value pairs are submitted\n\n",num);
    for(i=0; i < num; i++)
       printf("\%s=\%s\n",name[i],value[i]);
    Response.end();
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.