Jump to content

Communication With Php


ameliabob
 Share

Recommended Posts

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...