friedice Posted April 22, 2010 Share Posted April 22, 2010 friedrice is on a distinguished road Join Date: Mar 2010 windows 7 professional 10 posts melbourne Philippines au victoria friedrice is online now Report Post any php, js , PEAR expects here that can help me? ok im makin a gmap website for a uni subject its in PEAR templates problem i can seem to access the php variable in my js script in test.php i got $address= $_POST['address']; which gets it from input in prev page connected to dat php page is a test.tpl file where all html and js is there i tried this and all sort of methods var myVar = "<?php echo $address; ?>"; alert(myVar); but all it shows it <?php echo $address; ?> in the alert box i need that address value so i can pinpoint it on a gmap by calling a function like dat showAddress(<?php echo $address; ?>);return false; any ideas how to resolve it? thx [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
callesson Posted April 22, 2010 Share Posted April 22, 2010 Try calling the JS inside php tags and make a php varible for $_POST['adress']: <?php $address= $_POST['address']; echo "<SCRIPT> ... var myVar = '$address'; alert(myVar); ... </SCRIPT>"; ?> Quote Link to comment Share on other sites More sharing options...
Mchl Posted April 22, 2010 Share Posted April 22, 2010 Do you have PHP installed and running? Quote Link to comment Share on other sites More sharing options...
friedice Posted April 22, 2010 Author Share Posted April 22, 2010 ya it is installed i presummed since all other functions are workin like the sql statements are fine, its jsut the gmap thing. and also i cant just call the js in php since its on different files .php and .tpl but on the same page i tried using sessions but i couldnt get it to work im using PEAR templates thx for ur replies Quote Link to comment Share on other sites More sharing options...
Mchl Posted April 22, 2010 Share Posted April 22, 2010 If you see php code being displayed in your browser, it means that PHP is not interpreted on server. Does the file in question have a .php extension? If not, is the server configured to process such files as PHP? Quote Link to comment Share on other sites More sharing options...
friedice Posted April 22, 2010 Author Share Posted April 22, 2010 well im sure php is installed on the server since its a university server plus all other php stuff i used on other parts on the website works fine like rego and dynamically drop down boxes.. wat do u mean just incase and is there a way to check? im guessin is dat js is not registering dat php variable since both are different server and client side tools. Quote Link to comment Share on other sites More sharing options...
friedice Posted April 22, 2010 Author Share Posted April 22, 2010 also wat im thinkin is dat if im unable to resolve it maybe i can just use the js script for gmap which is pretty long in side php echo but it doesnt folow the PEAR template in my understandin or is it alright to include js in .php instead of .tpl since its part logic and presentation wise Quote Link to comment Share on other sites More sharing options...
friedice Posted April 22, 2010 Author Share Posted April 22, 2010 anyone? Quote Link to comment Share on other sites More sharing options...
friedice Posted April 23, 2010 Author Share Posted April 23, 2010 dw got it to work gmap works Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.