I have a php file (first.php) that uses the html form element to call a another php file (second.php) to email the data it collects. After the form is submitted this calls a third.php file to display an HTML formatted acknowledgement with a series of variable titles, such as "Subject:" together with the variable data, BUT no data appears. After the html section the third.php file displays a set of echoes of the variables and their data values, so all the files are working properly EXCEPT for that the <p>Subject: <?php echo $variable;?> </p> elements have no variable data in them though the data is there, as shown in the echoes at the bottom of the page.
second.php:
$file = 'third.php';
readfile($file);
echo nl2br ("\n\Label: \n"). $variable;
third.php:
<p>Subject: <?php echo $variable;?></p>
It should be working - as shown described here and e.g at https://www.w3resource.com/php-exercises/php-basic-exercise-3.php The php and html validate with no errors.
Edit (re comments below).
I tried forcing a failure by omitting a closing tag from a statement in third.php, in order to receive an error message and get some clue, but the scripts ran just the same! I looked at the result of a submitted form from first.php in FF Inspector. All third.php statements are shown commented out whereas the outputs of second.php statements are shown. So, the question seems to remain: how come the third.php statements are being commented out?
edit 2
Inserting the php echo statement of one of the variable into the html title tag of third.php results in the FF tab displaying the full php echo statement not it's value.
** SOLVED **
I understood Barmar's comment as saying that the require() was not "working", but it was, so that was that. Subsequently I've been struggling with the terminology around "writing" php files, in HTML and php, and had assumed that ALL php statements in php files would be interpreted (is that the right word?). I didn't realise that readfile() didn't work in the same way as include does, even after reading the PHP manual, especially as it seemed to be doing just that - except for the "glitch". The w3shools reference was just a blunder - we tend to see what we expect to see, and as I'd typed include and read() into a search engine ... In the end though the penny softly fell to earth. Out of options, I tried include ... The answer to my OP is that while require() does include the specified file, any php statements contained in it are not interpreted. And I've had the answer for 13 hours - I just couldn't see it.