View Full Version : Resolved Fill HTML Form from Multiple Text Files

08-10-2010, 05:07 PM

How would I go about filling an HTML form dynamically based upon which text file was selected to fill it? (the text file would be chosen via a link)

Hope this makes sense...

Thanks in advance!

- Jenn

08-10-2010, 05:20 PM
Somehow you would identify the filename. For example, the user could submit the filename directly but this would be a security problem. Alternatively you could create a list (array) of files using a code (the filename, an ID number, anything you'd like) and then search that list. Look into arrays in PHP for this. They are a little hard to learn/use the first time, but they are very useful and not extremely difficult.

Then once you know the path of that file, you can just use file_get_contents(MYFILE) and echo that into wherever you'd like on the page.

08-10-2010, 07:13 PM
Thanks for the quick response! I will definitely look into what you've suggested.