Rawns Posted April 27, 2006 Share Posted April 27, 2006 Ive createad a php file called index.php in a secure folder on my server. On the page is a text area called "textarea" and an update button called "update". When the page opens I want a main news file called mainnews.php to automaticly open into the text area so I can update it online. How would I go about doing this? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted April 27, 2006 Share Posted April 27, 2006 Use file_get_contents or fopen, for example:[code]<?php$file = file_get_contents("mainnews.php");echo '<textarea name="textarea">' . $file . '</textarea>';?>[/code] Quote Link to comment Share on other sites More sharing options...
Rawns Posted April 27, 2006 Author Share Posted April 27, 2006 [!--quoteo(post=369342:date=Apr 27 2006, 09:10 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Apr 27 2006, 09:10 PM) [snapback]369342[/snapback][/div][div class=\'quotemain\'][!--quotec--]Use file_get_contents or fopen, for example:[code]<?php$file = file_get_contents("mainnews.php");echo '<textarea name="textarea">' . $file . '</textarea>';?>[/code][/quote]Works fine! Thank you :) Quote Link to comment Share on other sites More sharing options...
Rawns Posted April 27, 2006 Author Share Posted April 27, 2006 Actually, I just noticed, it 'kind of works' fine. It displays only part of the file. It does not display the PHP tages or any of the print" "; tags, just the HTML. Whay is this? Quote Link to comment Share on other sites More sharing options...
Daniel.Conaghan1 Posted April 28, 2006 Share Posted April 28, 2006 [code]$file = file_get_contents("mainnews.php");echo '<textarea name="textarea">" ' . $file . ' "</textarea>';[/code]You may find extra quotation marks work. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.