Jump to content

Archived

This topic is now archived and is closed to further replies.

Rawns

Updateing a php file via another php file

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Use file_get_contents or fopen, for example:
[code]<?php

$file = file_get_contents("mainnews.php");

echo '<textarea name="textarea">' . $file . '</textarea>';

?>[/code]

Share this post


Link to post
Share on other sites
[!--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 :)

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
[code]

$file = file_get_contents("mainnews.php");

echo '<textarea name="textarea">" ' . $file . ' "</textarea>';

[/code]

You may find extra quotation marks work.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.