0

I am new to PHP, and I have this website. I want to know if i can have a page that is password protected (i know how to do that part), where the user can edit a variable from a text area.

Example: if i had a $news variable, and it would equal the news text on the home page. Is there a way that I can make a Text Area where the admin can write in the news they want, and have it change the variable, so they can change the variable without knowing the code? (With the click of a button)

If so, could you please tell me how? Thanks in advance.

Edited by kevinwcaulfield: n/a

2
Contributors
3
Replies
5
Views
7 Years
Discussion Span
Last Post by diafol
0

I am new to PHP, and I have this website. I want to know if i can have a page that is password protected (i know how to do that part), where the user can edit a variable from a text area.

Example: if i had a $news variable, and it would equal the news text on the home page. Is there a way that I can make a Text Area where the admin can write in the news they want, and have it change the variable, so they can change the variable without knowing the code? (With the click of a button)

If so, could you please tell me how? Thanks in advance.

You could, but where is you data being stored: hard coded into the page / a DB / a text file?

0

You could, but where is you data being stored: hard coded into the page / a DB / a text file?

Lets say, for my sake, that it is in a seperate news.php file that will contain just the $news variable, that will be included on the main page. (If that is possible.) Thanks. .

Edited by kevinwcaulfield: n/a

0

Lets say, for my sake, that it is in a seperate news.php file that will contain just the $news variable, that will be included on the main page. (If that is possible.) Thanks. .

Sorry, missed your reply - must have gone off the page. From this it seems you have a static news item (hard-coded in php) that is displayed on one page (news.php) and included in the main page (via include or require).

If you want to make changes to the actual news.php file, do so by hand (in your IDE). Otherwise, I'd think again about how you are storing this text. You can write to file via textarea, but seeing as your news.php isn't just plain html, it can get messy.

I'd suggest having a DB store your news articles which can then be ranked by date so that you always get the latest article.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.