Tell me how to make such a structure correctly. There are index.php and sometext.php . On the index.php page there is a form:

 <HTML> <HEAD> <TITLE>Отчет</TITLE> <meta charset="utf-8"> </HEAD> <BODY> <H3> <center><font color="#1E90FF">Отчет</font></H3> <center> <table width="1" border="0"> <form enctype="multipart/form-data" method="post"> <tr><td width="50%"><i>Планируемый адрес установки:</i></td><td align="right"><input type="text" name="install_address" maxlength="40" value="<?php if (isset($_POST['install_address'])) echo $_POST['install_address']; else echo "";?>"></td></tr> <tr><td colspan="2"><i>Примечание:</i><br><textarea cols="50" rows="3" name="free_descr" value="<?php if (isset($_POST['free_descr'])) echo $_POST['free_descr']; else echo "";?>"></textarea></td> </tr><tr><td colspan="2"><center><input type="submit" value="Генерировать"></center></td></tr> </form> </table> </center> <?php if ($_POST['free_descr']) { $install_address = $_POST['install_address']; $freedescr = $_POST['free_descr']; echo <<<EOT Полученные параметры:<br> <b>Планируемый адрес установки:</b> $install_address<br> <b>Примечание:</b> $freedescr<br> EOT; $sometext='sometext.php'; echo file_get_contents($sometext); }; ?> </BODY> </HTML> 

Contents of the file sometext.php :

 <?php ## Place<br> Место установки $install_address<br> ## Descr<br> Примечание $freedescr<br> Отправлено<br> ?> 

I'm trying to ensure that the content of sometext.php displayed on index.php . The content is displayed, but displayed as is, that is, $install_address and $freedescr not changed, and $freedescr and $install_address are written.

How to make the content change?

  • Are you sure you brought the correct code to sometext.php ? This should cause an error. - alias
  • one
    First, read the fresh one literally today ..... ru.stackoverflow.com/a/516862/191482 ........ and secondly .... where is the echo ? - Alexey Shimansky
  • @alias Error does not appear. 2 Alexey Shimansky, I am not strong in php, could you indicate where the 'echo' is missing? - Dan
  • <?php echo" ..... "; ?> <?php echo" ..... "; ?> - splash58
  • As I understand it, in the case of file_get_contents have to write the str_replace those variables that are in sometext.php , because everything that got the file_get_contents obtained with a regular line / text ....... you need rather include for such purposes ..... .but not forgetting to do <?php echo $install_address ?> and <?php echo $freedescr?> and the first tag and the final one, on the contrary, remove - Alexey Shimansky

1 answer 1

Try through the function Include_once () or include. there are examples in the internet