Page 1 of 1

problems writing to file (not naming the file correctly)

Posted: Sun Mar 21, 2004 12:06 pm
by andylyon87
This code doesn't seem to be working, it writes to the file but doesn't name the file as speified by the user from $save, it names the fill as a blank, but it works if I put time() in its place:

Code: Select all

if($save){
writetofile("$editing\n");
print("<TR><TD colspan=5><CENTER>file created/updated");
&#125;
function writetofile($editing)&#123;
$TheFile = "form_data/$save.txt";
         $Open = fopen ($TheFile,"w");
         if($Open)&#123;
                   fwrite ($Open,"$editing\n");
                   fclose($Open);
                   $Worked=True;
         &#125; else &#123;
           $Worked = False;
          &#125;
          return $Worked;
          &#125;
below is the code for the reference:

Code: Select all

<TR><TD colspan=5>Save As:<input type=text name="save" size=20>
Anyone who can help I would be very greatful

Posted: Sun Mar 21, 2004 12:08 pm
by doeboy
Have you tried $_POST['save'] or $_GET?

Posted: Sun Mar 21, 2004 1:06 pm
by andylyon87
thank you very very much