Monday, 15 June 2009

HTML forms & CGI C-Shell scripting

HTML forms are used to select different kinds of user input (Here's a quick tutorial). For example, open your favourite text editor, copy-paste the commands from listing 18.6. HTML -- Form processing example from here) and save the file as text.html.

Then from your browser, open the file to see what the form looks like. It should look like this:

Reading the form data from your shell script is a bit more tricky. You will probably have encountered html pages that look like

value1 and value2 are the parameters that your HTML form has submitted when you hit the submit button (assuming your form only has 2 parameters).

To read them in your c-shell cgi script, use
set input = $<>param1=value1&param2=value2)

so then you will have to split the string and read the parameters individually in different variables:
set param1 = `echo $input | cut -d '&' -f1 | cut -d '=' -f2`
and the same for param2.


Anonymous said...

Forms Processing refers to a service where data from different fields of entry is extracted and converted into electronic formats. This electronic data can be stored in a secure location and accessed from multiple locations. Our forms processing services can help you store large volumes of critical data efficiently and securely.