SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Earth
    Posts
    739
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    using $_SERVER['PHP_SELF'] within javascript

    Hi,

    How can you use $_SERVER['PHP_SELF'] within javascript in the manner below

    Code:
    <script language="JavaScript"> 
    function reload(form) { 
    var val=form.cat.options[form.cat.options.selectedIndex].value; 
    self.location='$_SERVER['PHP_SELF']?action=homework&cat=' + val ; 
    }
    </script>
    Thanks

  2. #2
    SitePoint Zealot nicc9's Avatar
    Join Date
    Jan 2005
    Location
    New Orleans, LA
    Posts
    181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lightbulb

    can't you do

    HTML Code:
    self.location = self.location + '?action=homework&cat=' + val

  3. #3
    SitePoint Zealot nicc9's Avatar
    Join Date
    Jan 2005
    Location
    New Orleans, LA
    Posts
    181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if not

    Code:
    <script language="JavaScript"> 
    function reload(form) { 
    var val=form.cat.options[form.cat.options.selectedIndex].value; 
    self.location='<?php echo ($_SERVER['PHP_SELF']); ?>?action=homework&cat=' + val ; 
    }
    </script>

  4. #4
    SitePoint Guru
    Join Date
    Aug 2004
    Location
    Earth
    Posts
    739
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by nicc9 View Post
    can't you do

    HTML Code:
    self.location = self.location + '?action=homework&cat=' + val
    Hi,

    Yer I figured that out after I posted. Works great thanks

  5. #5
    SitePoint Zealot nicc9's Avatar
    Join Date
    Jan 2005
    Location
    New Orleans, LA
    Posts
    181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no prob


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
  •