I need to echo an php include. I have tried the below but neither work?
echo "<td>include'file.php'</td>";
echo "<td><?php include/file.php'?></td>";
Why doesn't this work and how can this be achieved?
You don't have to echo included files, include means you are simply embedding the source code of page1 in page2, if you echo on page1 and you include on page2 and if your page1 has something like
echo 'hello';
This will be simply echoed on page2 when you include page1.
So you need to simply use include 'file.php'; that's it and use echo on file.php
Also, I would like to tell you that am sure you are doing something which is not usually done, like, why you need to include a file inside a just a td tag? Is that file used for some string/int output?
ob_start();
include 'file.php';
$output = ob_get_clean();
This way the php will be evaluated and all output will be saved into a variable
"This question does not show any research effort". I'm not sure how this question demonstrates any form of research effort. The manual page ( php.net/manual/en/function.include.php ) clearly shows an example that is completely NOT like this code. ( It even has an example echo-ing a string, then including something, then echo-ing again)echo, so you're already working "in PHP mode". Why, then, would you need to use the opening<?phptag again? why wouldn't you just use an include statement, and echo any markup as a string, no PHP in the strings at all. That would make your code more readable, wouldn't it?