Section for Week 7, Thursday, 2/25/99 1. Quiz!!! 2. For LA#6: a) cgi_helper::Get_Form_Data -- check against [^\w+*.&%+-] *before* any splitting of the query. b) cgi_helper: order: split(&), split(=), subst +'s, subst hex expr's c) response.cgi: First get form data, then output header (in case of errors, Error_Stop will be outputting its own headers). If any fields are missing, print a corresponding message, and then re-print the form (with the default values). Should probably use a seperate sub for the re-printing process. Otherwise, spit the values back a la test_get.cgi. Call CGI_Ender. d) sub print_form: The virtual form will be printed with a big here document, most likely. You can essentially copy the HTML form from the file you've saved it in to the here document, adding things to the form to get the default value settings. for each field in your form, think about how you will set the default value for the re-printing. Eg.: for the $field="name" field, you would probably store a string like "VALUE=$form_data{$field}" in a variable like $default_name (if it was defined, else "(no information)" for non-critical fields) and then in the corresponding part of the form printout statements, put: so if the name field was not filled in originally, the above variable will be empty and the field will be blank, but if it *was* submitted, then the new field will have the default value set already. To set default values for a checkbox, set the variable to CHECKED or nothing, and let it interpolate in the here document. Similarly for the SELECT fields, but you need to make sure to handle the possibility of multiple-input correctly (remember what Get_Form_Data does with fields for which multiple values are submitted: $;) Probably will want to use a hash table for these default values: $default{"Macintosh"}=SELECTED; $default{"old"}=CHECKED; $default{"name"}="VALUE=\"Ami Fischman\""; Explain the business with the quotes after VALUE=. Emph. that the response.cgi doesn't need to be so much universal as handle all the cases arising from the form *you* use. 3. Misc: Watch out for dropping multiple selections/words in the data Don't forget the (no info) on non-crit fields (doesn't apply to checkboxes, etc). Don't worry about embedded HTML in the user input (explain aobut this).