Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 21st, 2004, 12:08 PM
AAA AAA is offline
Registered User
Join Date: Jan 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Displaying a drop down list & contents of a file

I want to display a drop down list of files, and have the contents of the file displayed on the same page. Is it possible?

The drop down list displays ok, but I can't add the headers needed to display the file.

Can I use tables or something? If so how?

I need the following format (top to bottom)

Screen Format:

Drop Down List
Contents of File Selected.
Old March 22nd, 2004, 11:15 AM
Friend of Wrox
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts

You could try something like this:


<form id=form1 method=post action=page1.php>
<select name='files' onchange=document.forms.form1.submit();>
<option value=file1.txt>file1
<option value=file2.txt>file2
<option value=file3.txt>file3
 $getfile = file_get_contents($_POST['files']);
 echo "<textarea>$getfile</textarea>";

This should work, I think ;)


Old March 23rd, 2004, 09:34 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts

You can use an iframe to store your "file viewer" pane, and when a user clicks on a link in the main window, make an HTTP request in the iframe passing the name of the file to display.

Take care,


Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate drop down list with XML file rlull ASP.NET 1.0 and 1.1 Basics 5 November 30th, 2013 12:15 PM
Pass contents of drop down list to helper class snejsnej ASP.NET 1.0 and 1.1 Basics 0 April 12th, 2006 04:06 PM
populating a drop down with a file list cjcd ASP.NET 1.0 and 1.1 Professional 2 April 18th, 2004 10:37 AM
populating a drop down with a file list cjcd BOOK: Beginning ASP.NET 1.0 1 April 17th, 2004 02:53 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.