laserlight wrote:Could you provide the simplest and smallest script that demonstrates this problem? You might need to give some filenames to refer to in the include.
Thanks for helping laserlight. I finally got it working by entering php(<?php) on the first line of the included file, even though it was called from within a php script.
Here's a snippet from the original code. The include file is a copy of the in-line code starting at the commented print <<<END statement. However to make it work you must preceed this with a <?php tag.
-------------------------Demo Script---------------------------------
<?php
if(isset($_POST['Submitted'])){ // Test if user has filled in form and submitted it.
$Last_Name=$POST['Last_Name']; //Sample Variable Setting from form POST
$First_Name=$POST['First_Name'];
$Address1=$_POST['Address1'];
} /End of Simulated Form submission Handling. If initial entry, display empty form for user fill and submission. Otherwise retain entered values on form with inherited PHP variables. /
// Code to print html form. Remove appropriate comment tags to test either external file or in-line code.
require ('Interpolate.inc');
// Interpolate.inc only works if first statement starts with <?php... even though called from php.
/ print <<<END
<!-- Sticky Values Input form -->
<form action="Interpolate.php" method="post">
<font face="Georgia" style="font weight = bold">
<table border="0" cellpadding="0" cellspacing="0" width="635">
<tr>
<td width="298">
<b>Last Name
<input type="text" name="Last_Name" size="20" value=$Last_Name></b> <!--Sticky PHP Value -->
</td>
<td width="337">
<b>Street Address</b> <input type="text" name= "Address1" size="26" value="$Address1">
</td>
</tr>
<tr>
<td width="298">
<b>First Name</b>
<input type="text" name= "First_Name" size="20" value="$First_Name">
</td>
</tr>
</table>
<br><br><input type= "submit" value="Submit" method="post" Name= "Submitted">
</form>
END;
/
print "<br>$First_Name $Last_Name<br>$Address1"; //Display values.
?>