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? Link to comment https://forums.phpfreaks.com/topic/8576-updateing-a-php-file-via-another-php-file/ 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] Link to comment https://forums.phpfreaks.com/topic/8576-updateing-a-php-file-via-another-php-file/#findComment-31433 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 :) Link to comment https://forums.phpfreaks.com/topic/8576-updateing-a-php-file-via-another-php-file/#findComment-31456 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? Link to comment https://forums.phpfreaks.com/topic/8576-updateing-a-php-file-via-another-php-file/#findComment-31459 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. Link to comment https://forums.phpfreaks.com/topic/8576-updateing-a-php-file-via-another-php-file/#findComment-31640 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.