"TheSarge" <[EMAIL PROTECTED]> wrote > information (name and email). I think I am lost on whether or not my > actual > py script needs to link to a cgi script or if I can do it all in a > py
Your python script is a CGI script and it needs to run under a web server. There is a simple CGI server in the Python library that you can use for testing... > #!c:\python25\python.exe > import cgi, cgitb, os > > temp = """ > <html> > <body> > <form action=sample.cgi> > First Name: <input type=text name=fname><br> > Last Name: <input type=text name=lname><br> > Email: <input type=text name=email><br> > <hr> > <input type=submit> > </form> > </body></html> > > > """ > path = 'c:\\file' > # Create instance of FieldStorage > form = cgi.FieldStorage() > > # Get data from field 'name' > fname = form.getvalue('fname') > > # Get data from field 'address' > lname = form.getvalue('lname') The comments seem to be wrong, assuming the html in temp ids the same as is in the html file that calls this? > # Get data from field 'email' > email = form.getvalue('email') > > if not os.path.isdir(path): > os.mkdir(path) > e=open(path + '\\' + 'logbook.txt','a') > e.write("%s#%s#%s\n" % (fname,lname,email)) > e.close() > print 'Done' Bob has already pointed out the bug here... HTH, -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor