Jump to content

Archived

This topic is now archived and is closed to further replies.

friedice

any php, js , PEAR expects here that can help me?

Recommended Posts

 

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]

Share this post


Link to post
Share on other sites

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>";

?>

Share this post


Link to post
Share on other sites

Do you have PHP installed and running?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.