Okay, using include
in combination with return string
feels at least a quite unusual way to do this.
First of all imagine this situation:
return.php:
$html = 'blah blah blah';
return $html;
test.php:
$html = 'foo';
$html .= include( 'return.php') . 'bar';
Think about it ;) Your included script should overwrite global variable. You have to be really careful not to overwrite anything when you're doing this.
I'm strongly suggesting that you'll rather use function, classes, plugins for this (so many options) instead of using return $string
, but just try renaming variables first.
And are you sure that you're using return and not echo instead (inside form script)? Using just plain html is the same using echo
, you have to use return
to be able to use it like that, take a look at Example #5 include and the return statement.
Probably file_get_contents('form')
is the right solution for you.
Based on your comments:
If you have a file like:
form.php:
<form><blah blah blah></form>
It's equivalent to having:
<?php
echo '<form><blah blah blah></form>';
return 1;
If you'd make it:
<?php
$html = '<form><blah blah blah></form>';
There would be still implicit return 1
at the end.