Results 1 to 3 of 3

Thread: javascript, php, and MySQL

  1. #1
    Join Date
    Mar 2006
    Posts
    600
    Thanks
    5
    Thanked 4 Times in 4 Posts

    Default javascript, php, and MySQL

    ok i want to be able to see what page my visitors have seen. if add this into my php code:
    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.
    Last edited by benslayton; 01-21-2007 at 07:02 AM. Reason: Typo

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    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.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Mar 2006
    Posts
    600
    Thanks
    5
    Thanked 4 Times in 4 Posts

    Default

    Quote Originally Posted by djr33 View Post
    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •