Answer the question
In order to leave comments, you need to log in
How to replace one or more variables from one php file to another?
Hello, there is an index.php file on which the form is in the form "Login, Password, submit button". It is necessary that when you click on the "send" button, these data are overwritten in the account.php file, it looks like this:
<?php
$data= ['login' => 'Admin', 'password' => 'admin'];
?>
Answer the question
In order to leave comments, you need to log in
It is correct to use a DB for such things.
This is how you can, God forgive me:
$content = '<?php' . PHP_EOL;
$content .= '$data= [\'login\' => \'' . $_POST['login'] . '\', \'password\' => \'' . $_POST['password'] . '\'];' . PHP_EOL;
$content .= '?>';
$fp = fopen('account.php','w');
fwrite($fp, $content);
fclose($fp);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question