ameliabob Posted July 18, 2009 Share Posted July 18, 2009 I am trying to write a file on the browser side. I know that this is not allowed in JS so what I am trying to do is to get data from JS into PHP to write the file function Traceit(dir, whatisit){<?php fwrite($debugFile, dir.", ".whatisit); fclose($debugFile);?> } Traceit is called from a JavaScript function.Am I off in the wrong direction?? Link to comment Share on other sites More sharing options...
Ingolme Posted July 18, 2009 Share Posted July 18, 2009 PHP runs before the page is loaded, and once it has output the page, all the PHP code is gone.The code you just displayed, once parsed and sent to the client, will look something like this: function Traceit(dir, whatisit){ <b>Warning:</b> Unexpected T_STRING on line <b>XX</b> in <b>/home/www/file.php</b>} Link to comment Share on other sites More sharing options...
Synook Posted July 20, 2009 Share Posted July 20, 2009 You could use AJAX for this purpose. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.