PDA

View Full Version : javascript, php, and MySQL



benslayton
01-21-2007, 06:42 AM
ok i want to be able to see what page my visitors have seen. if add this into my php code:

$var =" <script> document.write(location.href); </script>";

It show the url of my log file and not what the visitors went to. Any one know how to do this? I would really like to have it all output as one varible, if possible.

Note: I am using a MySQL db.

djr33
01-21-2007, 06:58 AM
Er.... $var. Not var$.

You aren't going about it the right way. Javascript is interpreted after php, not before. The way to do that, I suppose, would be to track them using Sessions or Cookies (sessions use cookies, so probably best), and perhaps a database to store it all.

benslayton
01-21-2007, 07:02 AM
Er.... $var. Not var$.

You aren't going about it the right way. Javascript is interpreted after php, not before. The way to do that, I suppose, would be to track them using Sessions or Cookies (sessions use cookies, so probably best), and perhaps a database to store it all.

How would i do it using sessions. Im still in the learning stages of PHP.:)