Using HTML templates

The HTML that creates this contact form, with all its form elements and such,…actually lives in a template file on the server.…That template file is read by the CGI application.…It has tokens in it that are replaced by elements that are created by the CGI…application and that's what makes everything work the way that it does.…So let's take a look at this process and see how it works and why we do it this way.…Here is my editor and it's connected to the server and I am going to open this first.html.…This is in the html directory under the bw-contact directory and that's where…these template files live.…

So these are all template files.…I will go ahead and open first.html.…Now, this file is actually read not directly by the server but it's read by…the CGI application.…And as the CGI application reads this file,…it goes ahead and replaces things with values that it creates itself for various…reasons, like for instance here is a place for the CONFIRM_ERRORS.…If you try to submit the form and it's missing a value or something, you get a…

Resume Transcript Auto-Scroll

Author

Released

1/7/2010

CGI Essential Training highlights the skills required to build common gateway interface (CGI) scripts that allow web forms to interact with applications on a web server. Instructor Bill Weinman explains how these scripts can be used for simple interactive applications written in any programming language. Bill shows how to use CGI to set up an HTML template with hidden fields for use with a web server application. Exercise files accompany this course.