hey
I am trying to display my data which is present in a textfile (data.txt) format. I have to display this file as it is (the format of the file should not change) in a new window when a user asks for it.
to be more precise- I have a data.txt file which contain information about computers....these are in perticular format which i dont want to change.
Now when a user from the front end ask for this data it should disply it in a new window (IE) or may in a textarea (inside a form) in a new window (IE)...
please if any one can help me with this
Neha
Display text file data to textarea using php
Moderator: General Moderators
Re: Display text file data to textarea using php
first check if they asked for the data file by checking some $_POST variable. Then we let javascript open the file in a new window
<?php
if(isset($_POST['getdata'])){
echo "<script language='javascript'>";
echo "var win = window.open('data.txt','data');";
echo "</script>";
}
?>
<?php
if(isset($_POST['getdata'])){
echo "<script language='javascript'>";
echo "var win = window.open('data.txt','data');";
echo "</script>";
}
?>
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Re: Display text file data to textarea using php
To display text as is, you could make use of the <pre> HTML tag instead of a textarea, as well.
Re: Display text file data to textarea using php
hey thanks this html tag worked perfectly..superdezign wrote:To display text as is, you could make use of the <pre> HTML tag instead of a textarea, as well.
thakns
regards
neha