I'm not sure if this is the right thread to post this question, but I'll give it a try. I created a web page that gets some information from the user (via html forms), and stores the information on the server in a .txt file. I use python to take the entered data and creates the .txt file.
I now want to simplify the manual process of having to copy and paste the data in the .txt file, to my html file (web page).
Can someone recommend the best way to do this. I'm wondering if setting up a database using MySQL (which I've never used and would have to learn) is worthy of consideration. I'm open to ideas on how to easily (and preferably through automation) display the contents of the .txt file back to the web page. The one requirement is I want to display the data in a spreadsheet format.
Thanks for the help!
Euh, why not just change your HTML page to a script which loads the text file and inserts it into the appropriate place?
That is exactly what I would like to do; now how do I do that? I'm relatively new to html/python, and programming in general. If you know any online references that would help, I would greatly appreciate the reference. If the references can explain things from a newbies point of view, that would be very helpful.
I've seen this done with DHTML but that was some time ago and I sadly don't have an addy for the actual site..
Maybe it can help in your search though..
OK, instead of an HTML page, have a script (.py), set it up in the same way as your script that writes the file - but instead, have it open the file, read the contents and print them as part of the output. HTH.
Thanks to everyone who replied. I completed this task by writing a python script that opens the file, reads it, then writes it back to an html page.
I would have used an iframe e.g. <iframe src="youruserinfo.txt">
I know I probably sound stupid by asking this but what is python? I can guess and say its probably like PHP but does anybody know where you can get tutorials on it?
Python is a scripting language, much like Perl (and I'd guess Ruby also). It is interpreted, not compiled - also like Perl if I remember correctly.
I'm sure a Google search will do wonders if you're looking for tutorials, but off the top of my head I know of Bruce Eckel's "Thinking in Python" free online book...
if i were you i would go for php and a mysql database, its by far the best thing for that, and although it may take you a bit to get used to it, once you know how to use it will take you no more that 5 minutes to do what you need to do here...
About setting up a database and creating the php codes, just go google, you can even copy and paste the code, its just everywhere,,,
[EDIT
]
And also, there is a topic on writing to a fie in javascript that could be useful.
| minik wrote: |
I would have used an iframe e.g. <iframe src="youruserinfo.txt">
I know I probably sound stupid by asking this but what is python? I can guess and say its probably like PHP but does anybody know where you can get tutorials on it? |
Here is a link to a free beginners guide (in PDF form) to Python called How to Think Like a Computer Scientist: Learning with Python. Hope you find it useful. http://www.greenteapress.com/thinkpython/
Also here is the link to the official Python web site with lots more referances and advice. http://www.python.org/
Any other questions about Python would probably best discussed in the Others section instead of HTML, CSS, and Javascript.
i think you are currently trying to display the file in confirmation page. Am i right?
| Quote: |
| i think you are currently trying to display the file in confirmation page. Am i right? |
Thank you for your response. I actually solved this issue by writing a python script that opens the file, reads it, then writes it back to an html page.

The simplest way to do it is with an I frame.
Quick as well.
another thing you could do is use AJAX, though that might be overkill for something like this
Hey pal , just use the <PRE> tag , which is preformated content tag and can be used to display TEXT files easily .
Just give it a try ,
read the txt file , and use python / php to generate an HTML with PRE tag .
Go to the PHP forum and ask. Something like:
<?php
include("filename.html");
?>
I know it can be done with PHP
| pluto wrote: |
I'm not sure if this is the right thread to post this question, but I'll give it a try. I created a web page that gets some information from the user (via html forms), and stores the information on the server in a .txt file. I use python to take the entered data and creates the .txt file.
I now want to simplify the manual process of having to copy and paste the data in the .txt file, to my html file (web page).
Can someone recommend the best way to do this. I'm wondering if setting up a database using MySQL (which I've never used and would have to learn) is worthy of consideration. I'm open to ideas on how to easily (and preferably through automation) display the contents of the .txt file back to the web page. The one requirement is I want to display the data in a spreadsheet format.
Thanks for the help! |
Im assuming you want to convert txt to html,
if so,, I would highly recommend this free program called Easy text to Html converter at:
http://www.snapfiles.com/get/easytexttohtml.html