|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Hi ,I have a page with variable that contains the contents of a Text file and now i want to pass that vairable to another page .Here normal variables are passed but the variable that contains the text file contents are not passed.
This is the code i have written,please refer and find the fault . <? $a=array("bala","uday","prabha"); echo"Array contents are :"."<br>"; for($i=0;$i<count($a);$i++) { echo"<b>$a[$i]</b><br>"; } ?> <? $fs=fopen('project_text.txt',"r"); $s=fread($fs,filesize('project_text.txt')); echo'<body onload=parent.comment.location="comment.php?testc='.$s.'"'; ?> |
|
#2
|
||||
|
||||
|
You can only pass 1024 characters in the query string. If your text file is going to contain more than that, you'll encounter problems. Also, what's "parent.comment.location"? I've never seen anything quite like that before.
The best way to pass text like this will be either to pass the filename to the next script and let that script open the file or to stick it in a hidden field and POST it to the next page.
__________________
Please don't PM me asking for solutions outside the scope of a thread. Keeping all responses in a thread stands to help others who come along later, which is after all what this forum's all about. |
|
#3
|
|||
|
|||
|
Sir,actually my task is having three frames.In the left frame,I have a select box that displays the dir folders and when clicking the select box folders,it will dynamically displays the files retreived from the database.In the other 2 frames I want to display the output and the source code respectively.
Here everything is perfect,but the only problem is how to display the source code corresponding to each files. can u help me... |
|
#4
|
||||
|
||||
|
Seems like you've got it just about right. All you have to do is have the page loaded in the frame take a database ID as a parameter. The page then loads in your frame and queries the database (or the filesystem) to load the necessary text. It seems that you're trying to pass the text itself, when it's better to pass a reference to the text and to have the newly loaded page load the text.
|
|
#5
|
|||
|
|||
|
Thank u sir,But I'm new to PHP.So,please can u show me an example for using database ID and how to pass and display it...
|
|
#6
|
||||
|
||||
|
That's pretty basic stuff. If you're not familiar with such basics, you need to find a book or tutorial on PHP fundamentals. Essentially, I'm suggesting that you pass either a database or a filename in the query string (http://www.url.com?id=00001, for example) and then use that id in the resulting file to query the database or open the given text file. This is something you'll do over and over again in PHP development, so understanding it now is crucial. There are probably tutorials on this site that will provide general information that'll help you out. I'm afraid I don't have time to rewrite what many others have already written.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > passing file contents as variable |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|