473,587 Members | 2,524 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

option box selection results in text file display

ok, I'll explain this the best way I can... What I am trying to do is create an option box with several options, now by selecting option #1 will display Text File #1 in a textbox below the option box.... Option#2 displays Text File#2, and so on so forth, problem is I can figure out how to make the page load the text files.... any and all help will be greatly appreciated....

thanks in advance
Oct 7 '10 #1
1 1562
dlite922
1,584 Recognized Expert Top Contributor
You can do this two ways.

1. PHP alone

Use the onchange() trigger on the option box to submit the page. Parse it with PHP and redisplay the page with the file included. use php's function file_get_conten ts() and echo it to a text box, html, or whatever the case maybe.

2. AJAX
Do the same thing but using javascript to get the file back. The easiest way to do this is to have a PHP function print a given file like this: print_file.php? filename=myfile 2.
That page would just return the contents of the file, in this case, a file called myfile2.

With jQuery it's easy to use the load() function to load the return of this file into an element of text area.



Attempt either method and let us know where you get stuck.


Dan
Oct 7 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
6294
by: Dan | last post by:
Can anyone offer suggestions on how to do this or if it is possible? I have a form that uses a drop down box and 2 text fields. What I am trying to do is have the value of each text box set by the choice from the drop down box. Something like: <form name="populatefrm" id="contactfrm" method="post"
2
5254
by: Tim2Be | last post by:
I have a text file that has a length of 840 bytes. I need to split into 20 bytes starting from byte 1. If there are data in any of the 20 bytes, I display the data. So there are 42 occurences of 20 bytes. How do I read each of the 20 bytes and display the data in C#?
5
2850
by: CCLeasing | last post by:
Hello, I have searched google but can not find a straight forward answer to my problem. Hopefuly someone will be kind enough to offer their expertise. Please forgive if this seems a bit convoluted but this is probabally a reflection of my not clear understanding of the mechanics behind what i'm trying to achieve. Please bear with it I really...
0
1908
by: CCLeasing | last post by:
Hello, I have searched google but can not find a straight forward answer to my problem. Hopefuly someone will be kind enough to offer their expertise. Please forgive if this seems a bit convoluted but this is probabally a reflection of my not clear understanding of the mechanics behind what i'm trying to achieve. Please bear with it I really...
2
4279
by: ahynes | last post by:
HI folks, I'm a chem engineer with no VB programming knowledge (as you'll see from my question!) I want a script to open a .txt file, insert pre-defined text into the start and end of the file, then close teh saved file with a .nc extension. I'd like to have this as a batch file or exe file which i can installt o run from my users...
2
19706
by: ahynes | last post by:
HI folks, I need a script to open a .txt file, insert pre-defined text into the start and end of the file, then close teh saved file with a .nc extension. I'd like to have this so I can run it from my desktop. I tried doing it in Word using macros and the FileDialog thingy to bring up dialogs for the user to select his files but it would...
1
1256
nehashri
by: nehashri | last post by:
hello Can any one please help me in the following..... I making a database with Access and ASP. I have created a search option where I have a text box and a submit button. the result to this search is displayed in the same page. all i want is a option where user can choose between printing the results in the same page or in a text file.... the...
6
2468
by: portCo | last post by:
Hello there, I am creating a vb application which is some like like a questionare. Application read a text file which contains many questions and display one question and the input is needed from user to calculate the score. Here is a problem. I can read a text file. However, it's read whole file at a time. So,
1
1138
andotz14
by: andotz14 | last post by:
we have just started our lessons on turboc, and our teacher asked us to create programs we don't know how to create..do anyone of you knows how to create a program that when executed we can use the up and down buttons, and we can select a word from the output, and when selected, the word will be highlighted, what functions should i use?
1
1937
by: hotrod57 | last post by:
I am trying to append the results from a form to a text file. My code is supposed to print out the results on one page, and append the results to another page each time data is entered on the form and the submit button is hit. Unfortunately, it is only printing out the message acknowledging the submit button--no data on either form. Here is the...
0
7918
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8206
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6621
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5713
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.