|
I've worked for hours on this. Any help is appreciated.
I've got something line this. I'm inputting variables in a form. selecting a template from a db table, then writing a web page.
for simplicity say the template is: <html>$var</html>
Page:
$template='test';
$page='test';
$var='marcia';
$query11="SELECT template_text FROM `page_template` WHERE template = '$template'";
$result11=mysql_query($query11) or die ("couldn't execute query11");
$num11=mysql_numrows($result11);
$template_text=mysql_result($result11,$i11,"templa te_text");
$depage="$template_text";
$page="/subdirectory/$page.php";
$myfile = fopen ("/home/name/public_html/$page","w");
fwrite ($myfile, "$depage\n");
fclose ($myfile);
The page is written but it is:
<html>$var</html>
-----------------------------------------------------------------
Now if I do this it works:
$page='test';
$var='marcia';
$depage="<html>$var</html>";
$page="/subdirectory/$page.php";
$myfile = fopen ("/home/name/public_html/$page","w");
fwrite ($myfile, "$depage\n");
fclose ($myfile);
This writes the following page test.php which is what I want:
</html>marcia</html>
-----------------------------------------------------------
How do I get example 1 to work using the template with the variable in it?
|