- Code: Select all
while ($p < count($categoryarray))
{
if (!file_exists($statepath.$categoryarray[$p]))
{
$ourFileName = "$statepath$categoryarray[$p]";
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
$stringData = "php script goes here";
fwrite($ourFileHandle, $stringData);
fclose($ourFileHandle);
}
$p++;
}
Hi Im trying to use this code to dynamically create a
php file, for instance how do I insert this code:
- Code: Select all
include 'connectdb_techs.php';
include 'input_check.php';
$area = sql_quote($_POST['state']);
if ($area == '') { $area = sql_quote($_GET['state']); }
$cat = sql_quote($_POST['cat']);
if ($cat == '') { $cat = sql_quote($_GET['cat']); }
in $stringData without it closing the statement early, and end up with a valid
php file??
Thanks,
Nathan.