Hi I'm php newbie. For example, I have a php file like this: <? $value1="content1"; $value2="content2"; ?> PHP: 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. Thank you
You can do this with the POST function in a form. So basically make a form that submits the information to itself. <form action="<?php echo $PHP_SELF;?>" method="post"> <input name="value1" type="text" /> <input name="value2" type="text" /> <input type="submit" value="submit" name="submit"> HTML: Then after that, get the form info with php. //Establish the variables $value1 = "default_value1"; $value1 = "default_value2"; //Check to see if form submitted. if(isset($_POST['submit'])) { //Update the Variables $value1 = $_POST['value1'] $value2 = $_POST['value2'] } PHP: Whatever you want to do with the variables after that is up to you. But that would update the value of the variables based on the information in the form.
if I have 2 files: setting.php & config.php config.php - file contains values such as $value1="content1"; $value2="content2"; setting.php - page with 2 input forms and allow user update value from config.php file. So ho do I do that? I have tried above code but it didnt change new values. Thanks