I'm php newbie. For example, I have a php file like this:
php Code:
<?
$value1="content1";
$value2="content2";
?>
Now I want to create a HTML site with 2 input forms allow me change the values (content1, content2) without edit above file manually. I can enter new data and click update button, then it will update new values of above php file.
How do I create this file? There are no SQL DB or complicated functions.
There 2 ways you can do it that I know of, either by using a database which is probably the easiest option, or storing the content for each variable in a txt file.
i agree with enigma, only two 2 ways i can think of, and i think it would be better to go down the road of using a database rather than a flat file (text file)
I created a small script with comments for you to use in order to change the two variables from PHP. You can see the full explanation on my blog along with a PHP tutorial for it.
1) You can update those values for a single instance of that page. So you could set them and display them further down the script.
2) You want to set them permanently ie. Someone can load the page, change the variable and close it and then the next person to open the page would see those changes.
The first case is easier and just requires the use of either $_GET['field'] or $_POST['field'] in your PHP.
For the second one, it would probably be easiest to use a text file to store the information.