passing php values into java script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sarbas
Forum Commoner
Posts: 64
Joined: Thu Jan 04, 2007 5:51 am

passing php values into java script

Post by sarbas »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi Folks,

               I am using follwing google map script. I want to pass my php values into this script. I want to pass php values into  [b] "City, State, Country",[/b] this line. Can anyone help me? 

[syntax="javascript"]<script type="text/javascript">
    function LoadMapSearchControl() {

      var options = {
            zoomControl : GSmapSearchControl.ZOOM_CONTROL_ENABLE_ALL,
            title : "Complex",
            url : "http://www.google.com/corporate/index.html",
            idleMapZoom : GSmapSearchControl.ACTIVE_MAP_ZOOM-2,
            activeMapZoom : GSmapSearchControl.ACTIVE_MAP_ZOOM-2
            }

      new GSmapSearchControl(
            document.getElementById("mapsearch"),
           [b] "City, State, Country",[/b]
            options
            );

    }
    // arrange for this function to be called during body.onload
    // event processing
    GSearch.setOnLoadCallback(LoadMapSearchControl);
  </script>
Regards


feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

What have you tried?
sarbas
Forum Commoner
Posts: 64
Joined: Thu Jan 04, 2007 5:51 am

Post by sarbas »

I tried with google.But i dont know about java script. thats why i posted here.

sorry feyd.
Next time onwards i'll follow rules and regulations to post the topic.

Regards
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

Code: Select all

<?php
$var = 'foo';
?>
<script type="text/javascript">

var someVar = '<?php echo $var; ?>';
alert(someVar);

</script>
sarbas
Forum Commoner
Posts: 64
Joined: Thu Jan 04, 2007 5:51 am

Post by sarbas »

Thanks a lot Jenk.Its Working...

Keep Continue Your help...

Regards
Post Reply