#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Rotterdam
    Posts
    76
    Rep Power
    12

    PHP in JavaScript


    Hi,

    I have a JavaScript function, but i have problems with the syntax of an if-else statement.
    On else the visitor is supposed to go this url '$_SERVER['PHP_SELF']?manage=yes'
    but the '=' sign is giving me problems. I tried various notations but none of them worked.
    How can I escape the '='? and make
    PHP Code:
    location = "<?=$_SERVER['PHP_SELF']?manage=yes?>";
    work?

    Or should i post this in the php section?
  2. #2
  3. kill 9, $$;
    Devshed Supreme Being (6500+ posts)

    Join Date
    Sep 2001
    Location
    Shanghai, An tSín
    Posts
    6,897
    Rep Power
    3887
    I don't do PHP but couldn't you do this:
    Code:
    location = "<?=$_SERVER['PHP_SELF']?>?manage=yes";
    Just an idea.
    ~ishnid;
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Rotterdam
    Posts
    76
    Rep Power
    12
    thanks ishnid,

    i had totally overlooked that notation and it works excellent.
  6. #4
  7. PHP & Java Error Master
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jun 2003
    Location
    My Computer
    Posts
    1,219
    Rep Power
    0
    For not doing PHP you got that perfectly ishnid
  8. #5
  9. kill 9, $$;
    Devshed Supreme Being (6500+ posts)

    Join Date
    Sep 2001
    Location
    Shanghai, An tSín
    Posts
    6,897
    Rep Power
    3887
    It's the same concept as breaking in and out of HTML in a JSP. I don't have a clue what $_SERVER['PHP_SELF'] means!

IMN logo majestic logo threadwatch logo seochat tools logo