#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Posts
    14
    Rep Power
    0

    javascript & PHP


    i have a PHP array called $happy and i wish to print it with javascript

    i have
    print("document.write('$happy[0]');");

    it seems that javascript doesnt like the []. what do i do to solve this problem
  2. #2
  3. No Profile Picture
    The New User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    109
    Rep Power
    11
    using PHP's print() function, you cannot print out arrays directly in the string. The correct syntax (if I correctly understand your wishes), would be
    print("document.write(' ".$happy[0]." ');");

    Hope that helps.

    --Neil

IMN logo majestic logo threadwatch logo seochat tools logo