Link a drop-down list to display content of file

635 views Asked by At

I have a quick need and have not been able to get around this but hopefully someone will point me in the right direction.

I have the following simple HTML drop-down code:

<!DOCTYPE html>
<html>
<body>

<h2>Simple Result Page</h2>

<select name="listresults">
<option value="abc">Server One</option>
<option value="efg">Server Two</option>
<option value="hij">Server Three</option>
</select>

</body>
</html>

I have three html files or text file per servers as the case may be with some information in it and I would like when a user selects the first list say Server One, this should only display the content of server one (.html or .txt) file.

Sample html/txt file:

Drive     User         Size(GB)
-----     ----         --------
C:        User1           2
C:        User2           8
C:        User3           10

Please if this is already answered elsewhere, post the links. Thanks

1

There are 1 answers

1
Joran Den Houting On

You'll need a php file getting the content of the txt file and Ajax to show the result in your html when selecting a server! Go and take a look for the php function called file_get_content and do a search for Ajax! It's quite easy to get the result you're looking for.