ne = "'pre_input.py?name="+f['name'].value print """ <form action="""+ne+"""' method="POST"> <input type="text" name="pre" /> <input type="submit" /> </form> """ asd = f.getfirst('pre','') if asd != "": ht = """ <h1>%sに所属する路線一覧</h1> """ q = f.getfirst("pre","") print ht % str(q) data = train.url_get(q) line_name,line_cd = data.get_Line() ht2 = "<form action='pre_input.py?name=%s&pre=%s' method='post'>" count = 1 for na in line_name: ht2 += "<input type='radio' name='line' value='"+str(na)+"' id='"+str(na)+" ' /><label for='"+str(na)+"'><font size = 5>"+str(na)+"</font></label>" if count % 5 == 0: ht2 += "<br/>" count += 1 ht2 += "<input type='submit' label='OK'/></form>" print ht2 % (f['name'].value,str(q)) ht3 = ''' <h1>この路線で間違いないか?</h1> <h2>%s:%s</h2> <form action="input.py?name=%s&pre=%s&line=%s" method="post"> <input type="submit" />
""" print html form = cgi.FieldStorage() pre = form.getfirst("pre", "No") line = form.getfirst("line", "No") ne = "'input.py?name=" + form["name"].value + "&pre=" + pre + "&line=" + line if "No" == str(line): print "<body>クエリに路線名が入力されていません</body></html>" else: print "<h1>出発駅を入力するんだ!</h1>" print """ <form action=""" + ne + """' method='post'> <select name='start'> <option value='No'>--出発駅--</option>""" op = "" data = train.url_get(form["pre"].value) line_name, line_cd = data.get_Line() istname, listcd = data.cahge_name_cd(line_name, line_cd, line) """ マルコフ Markov.start(form['start'].value) 推薦リストの作成 """ for na in istname: op += "<option value=" + str(na) + ">" + str(na) + "</option>" op += "</select><h1>目的駅を入力するんだ!</h1><select name='end'><option value='no'>--目的駅--</option>" for na in istname: op += "<option value=" + str(na) + ">" + str(na) + "</option>" op += "</select><input type='submit'/>"