Having a strange problem with some PHP code.

This code:

$filename = "/u2/text/TOPAShiftlog".$dateString."_AShift.rtf";

writes the file TOPAShiftlog2007-10-26_AShift.rtf to the /u2/text dir.

I want it to write 2007-10-26_AShift.rtf to the /u2/text/TOPAShiftlog dir

so I tried this:

$filename = "/u2/text/TOPAShiftlog/".$dateString."_AShift.rtf";

This code ends up removing my "submit" button altogether. I don't understand why the / is causing the problem. Here is the meat of the code:

$filename = "/u2/text/TOPAShiftlog/".$dateString."_AShift.rtf";
     $handle = fopen("$filename","w");
	 $date1[$i]=$row['date'];

$message = "Station Log ";
$message = $message."Date: ".$date1[$i]." \n"	;
.....
$message = $message."\n\n";


	if(!fwrite($handle, $message)){
		print "Cannot write to file";
		exit; 		}
 	#print "Success, wrote ($message) to file ";
  $message = "";

	fclose($handle);    
    
     $i++;
    }
    ?>
        
  </table>
  <br><input type = 'hidden' name = 'todaym' value = <?=$todaym?>><input type = 'hidden' name = 'todayd' value = <?=$todayd?>><input type = 'hidden' name = 'todayy' value = '<?=$todayy?>'>
  <input type='submit' name='Submit' value='Submit'>

</form>

Any ideas would be appreciated
DS

When you do a view-source on the page, what is the output?

The HTML code gets cut off before the end...doesn't even get to the "submit" portion of the code.

Actually seems hit or miss. I just refreshed and get a "cannot write to file error" from the php script before the submit button code. So looks like it is erroring out before getting to Submit.

It was a permissions problems. Looking at the view source pointed that out. Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.