如何在不同的PHP / HTML文件中创建表单更改文本? [关闭]

I'm making a "banner.php" thing that's included in every single page of my site so I can have alerts about when site maintenance is, etc. So my question is, How do I make a form change text in a different HTML file?

As in: Make a page (admin.php) or some page like that have a form with a button. Whenever I change the form and hit the button, it makes banner.php's text change.

I know it would involve a variable in the banner.php file, but I'm not sure how to execute a line of code that would change said file from a different file.

There are many ways to achieve this, the simplest would probably be to store your new content in a file.

Something along these lines:

admin.php:

<form action="save.php" method="post">
New value: <input type="text" name="new_text">
<input type="submit">
</form>

save.php:

<?php
file_put_contents('banner_content.txt', $_POST['new_text']);

banner.php:

<?php
echo file_get_contents('banner_content.txt');

This is extremely basic, and I would definetely not recommend that you use it as is - it has no security measures whatsoever, and is probably not very useful on it's own either... but it's a starting point if you are completely blank.

you can read the banner file
$banner=file_get_contents("banner.php");

so after doing the changes in a form or wherever you can save your data in the file and overwrite it:

file_put_contents("banner.php",$banner);