Internet Toolkit Troubleshooting WizardCGI BasicsSimply put, a CGI routine is any program capable of accepting information from a client (Web browser), processing that information in some way, and sending a response back to the client. For example, any Web page that contains HTML form elements--such as ring menus, text fields, and radio buttons--and has a "Submit" button for the user to press once the elements have been filled out uses a CGI routine to process the submission. With the Internet Toolkit, you can create CGI VIs using standard G programming techniques. To see examples of CGI VIs in action, go to your default server homepage (see Getting Started), then follow the CGI Examples >> CGI Basics links. Specifically, examine the CGI Call With Multiple Parameters (POST) example. As explained on that example page, pressing the Submit button invokes the CGI VI /cgi-bin/examples/post_mlt.vi. (You can observe how a CGI VI is associated with a link or a Submit button by examining the HTML source for the example page) This CGI reads the values of the ring, radio button, and text field as you have submitted them and returns a table summarizing your choices. This is what the diagram of the post_mlt VI looks like: ![]() Crucial sub-VIs that will be contained in every CGI VI that you create are circled in red. The left-most sub-VI is responsible for obtaining the environment and any content string submitted by the client and providing that information to the rest of the diagram in the form of a keyed array and a string. The next outlined sub-VI to the right is responsible for sending a response back to the client to be displayed in the browser. Typically, this response comes in the form of regular HTML or a reference to an existing URL. The last sub-VI frees the resources associated with this particular CGI call. The VIs not outlined in red are specific to decoding the form elements that were passed to this CGI in this example using the POST method, as well as building an HTML table to be returned to the client browser. NOTE: The building blocks for creating CGI VIs--including those outlined in red in the above diagram-- can be found on the LabVIEW Functions palette under User Libraries >> Internet Toolkit >> CGI VIs >> CGI Template VIs: ![]() |


