more advanced examples this is an optional section one of the advantages of having program running on public server is that data may be stored centrally and augmented and shared by all in high performance sites data is typically stored in sophisticated databasebeyond the scope of this tutorial for less robust but simpler way to store data persistentlywe can use simple text files on the server the www example page namelist html uses namelist cgi to maintain file namelist txt of data submitted by users of the page you can test the program with your local python server it is less impressive when you are the only one who can make changesthe source code is documented for those who would like to have look you also may want to look at the source code of the utility script you have been usingdumpcgi cgi it uses method of getting values from the cgi data that has not been discussedval form getlist(namethis method returns list of values associated with name from the web form the list many have or many elements it is needed if you have number of check boxes with the same name (maybe you want list of all the toppings someone selects for pizza both dumpcgi cgi and namelist html add an extra layer of robustness in reflecting back arbitrary text from user the user' text may include symbols used specially in html like '<the function safeplaintext replaces reserved symbols with appropriate alternatives the examples in earlier sections were designed to illustrate the flow of data from input form to output pagebut neither the html or the data transformations have been very complicated more elaborate situation is ordering pizza onlineand recording the orders for the restaurant owner you can try and look at the supporting example www files pizza cgipizzaordertemplate htmland the simple pizzareporttemplate html to see the reportthe owner needs to know the special name owner after ordering several pizzasenter that name and press the submit button again this cgi script gets used in two ways by regular userinitiallywhen there is no orderand later to confirm an order that has been submitted the two situations use different logicand the script must distinguish what is the current use hidden variable is used to distinguish the two caseswhen pizza cgi is called directly (not from form)there is no paststate field on the other hand the pizzaordertemplate html includes hidden field named paststatewhich is set to the value 'order(you can confirm this by examining the end of the page in kompozer' source mode the cgi script checks the value of the field paststateand varies its behavior based on whether the value is 'orderor not the form in pizzaordertemplate html has radio buttons and check boxes hard coded into it for the optionsand copies of the data are in pizza cgi keeping multiple active copies of data is not good ideathey can get out of sync if you look at the source code for pizzaordertemplate htmlyou see that all the entries for the radio button and check box lines are in similar form in the better version with altered files pizza cgi and pizzaordertemplate html (that appears the same to the user)the basic data for the pizza options is only in one place in pizza cgiand the proper number of lines of radio buttons and check boxes with the right data are generated dynamically to do the dynamic generationtemplates for an individual html line with size radio button is in the source codeand it is used repeatedly to generate multiple lineseach with different size and price embedded into the format string from the program data these lines are joined together and placed as one entity into the html form template similar procedure is done with the toppings and check-boxes the logic of using the hidden input field is futher outlined in html source markup (page further possible elaboration would be to also allow the restaurant manager to edit the sizecost and available topping data onlineand store the data in file rather than having the data hard coded in pizza cgiso if the manager runs out of toppingshe can remove it from the order form this change would be fairly elaborate project compared to the earlier exercises dynamic web pages