Re: Can't let go of first php success

by "Darrell King" <darrell(at)webctr.com>

 Date:  Sun, 23 Jun 2002 17:18:28 -0400
 To:  "Tenley Shewmake" <ts(at)awebresource.com>,
"HWG Techniques" <hwg-techniques(at)hwg.org>
 References:  awebresource
  todo: View Thread, Original
Your server has to be set to parse the file type as PHP. Many servers do not
parse .htm or .html files automatically to avoid unnecessary work for the
server. Try puting this in a .htaccess file in your HTML root (assuming you
are working with Apache!):

AddType application/x-httpd-php htm html php

----- Original Message -----
From: Tenley Shewmake
To: HWG Techniques
Sent: Sunday, June 23, 2002 7:42 PM
Subject: Can't let go of first php success


Hi All,

I'm now working on the mysql/php database idea for the log cabin site,
but can't drop my "file capture" script with which I am still wrestling
(Yes, I have to learn php the hard way). Using a tip from Gregory Welling,

I enclosed the output of my form in

<?php $content="       "; ?> //did a LOT of escaping

and ended with:
<?php
$filename="fullpath/whatever.html";
$myfile=fopen($filename,"w+") or die ("Could not create file.");
fwrite($myfile,$content) or die ("Could not write to file.");
fclose($myfile);
echo $content;
?>

I can open and write the file, but $content includes both html and php,
and although the form data is showing up in the php statements, those
are just printed out, not executed. Source of the generated file is now
showing:
<td class="papercolor">
<h2><?php echo 'Circa' . ' ' . 1567 . ' ' . ucfirst(Smith) . ' ' . Barn;
?> </h2>

instead of

<td class="papercolor">
<h2>Circa 1567 Smith Barn</h2>

So, how do I capture the php output into a variable?


Best Regards,

Tenley

Tenley Shewmake, Webmaster Alterra Furniture
http://www.awebresource.com/furniture/
ts(at)awebresource.com

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA