Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up In JavaScript can I use Php

    Hi
    I need Help can I use Java Script in php orrr php in javascript.
    http://www.goodclassified.com/
    Please Reply Soon Example

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,243
    Thanks
    203
    Thanked 2,555 Times in 2,533 Posts
    Not sure what you mean by "use".

    You just echo/print the javascript like you would do with html, like:
    Code:
    <? 
    echo "<script type='text/JavaScript'>\n"; 
    echo "alert('Javascript from php');\n"; 
    echo "</script>"; 
    ?>
    Suggest you Google for more information on how php and Javascript can (and cannot) interact.
    Example:-
    http://www.skytopia.com/project/arti...psci/form.html

    It is your responsibility to die() if necessary….. - PHP Manual
    Last edited by Philip M; 08-17-2011 at 10:10 PM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.


  •  

    Posting Permissions

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