fergald Posted December 12, 2007 Share Posted December 12, 2007 Hi, please forgive me if this is a stupid question or in the wrong area. I have a piece of code wrote in a php page similar to this $filename=$_SERVER["DOCUMENT_ROOT"]."/Training/fred.php"; $fh = fopen($filename, 'w') or die("can't open file"); $theData="<? unset($_SESSION\['page']); $user = $color; //echo \"fergal user is $color\"; if($user==\"\"){ $receivedfoldername=$_REQUEST\[\"user\"]; if ($receivedfoldername == \"\"){ }else{ $color=$receivedfoldername; } } "; fwrite($fh, $theData); fclose($fh); now when i execute this its fine, then i go to my fred.php which is create with theData and if fails i think the problem is here unset($_SESSION\['page']); it does not like strings containing [] - is their a way to avoid this or am i doing this totally wrong. Any help would be much appreciated. Kind Regards Fergal. Quote Link to comment Share on other sites More sharing options...
trq Posted December 12, 2007 Share Posted December 12, 2007 You'll want to use single quotes around the data. <?php $theData = '<? unset($_SESSION["page"]); $user = $color; //echo "fergal user is $color"; if($user==""){ $receivedfoldername=$_REQUEST["user"]; if ($receivedfoldername == ""){ }else{ $color=$receivedfoldername; } } ?>'; I'm really not sure why you would be wanting to dynamically generate php though. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.