Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2006
    Posts
    76

    JavaSvript & PHP

    Hi
    i write this function , its copy values from database to java array by using php , i got this way from my head , i want to know is there other effective way ?

    what i did here is include java code in php script , can i include php in java code ?
    i know javascript is client-side and php server-client but i wonder if there is someway to do this ...

    <script type="text/JavaScript">
    function selectmnue(myselect, myvalue) {
    var jmake=new Array();
    <?
    $i=0;
    do{

    echo "
    jmake[". $i ."] = \"". $row_java_array['MAKE'] ."\";
    ";
    $i++;
    }while($row_java_array = mysql_fetch_assoc($java_array));
    mysql_free_result($java_array);
    ?>

    //here i want to use these values
    }
    </script>

  2. #2
    Join Date
    Jul 2006
    Posts
    95
    I usually do the same thing in my code. Sure there will be some other way like Ajax through xml request in javascript.

  3. #3
    Join Date
    May 2004
    Location
    NYC
    Posts
    793
    Yes you can do what you have typed, and it will work.

    I've written lots of mixed javscript/php where some of the javascript is generated by php and then used by javascript already in the file, exactly as you are trying to do.

  4. #4
    Join Date
    Mar 2006
    Posts
    961
    With PHP and Javascript, you could always use the:

    PHP Code:
    <?php echo ...; ?>
    command between your JS codings.

  5. #5
    Join Date
    Jun 2006
    Posts
    76

    lol good idea

    Quote Originally Posted by horizon
    With PHP and Javascript, you could always use the:

    PHP Code:
    <?php echo ...; ?>
    command between your JS codings.

    hehe thanks , i really dont know why i don't think in that
    its better than used escape chars .. its also confusing me

  6. Newsletters

    Subscribe Now & Get The WHT Quick Start Guide!

Related Posts from theWHIR.com

Posting Permissions

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