SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2003
    Location
    Pakistan
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    passing string from PHP

    <html>
    <script>
    function dodelete(a)
    {
    alert(a);
    }

    </script>>

    <?

    $abc='salman';

    echo("<A href='javascript:dodelete($abc);'>click here </A>");

    ?>
    </html>

    This is the code...i want to pass a string variable of PHP to a javascript function but it returns an error...kindly could someone help me????
    regards

  2. #2
    SitePoint Enthusiast
    Join Date
    Oct 2003
    Location
    Pakistan
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <html>
    <script>
    function dodelete(a)
    {
    alert(a);
    }

    </script>>

    <?

    $abc='salman';

    echo("<A href='javascript:dodelete($abc);'>click here </A>");

    ?>
    </html>

    This is the code...i want to pass a string variable of PHP to a javascript function but it returns an error...kindly could someone help me????
    regards

  3. #3
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this:
    Code:
    echo("<A href=\"javascript:dodelete('$abc');\">click here </A>");


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
  •