Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spremanje javascript vrijednosti u PHP varijablu
Author Message
Son Goku Offline
Novi korisnik
*

Posts: 41
Joined: Jan 2008
Reputation: 0
Post: #1
Spremanje javascript vrijednosti u PHP varijablu
Pozdrav. Vec dugo me muci ovaj problem i nikako naci rijesenje.

PHP Code:
var geo google.gears.factory.create('beta.geolocation');

function 
updatePosition(position) {
  
alert(position.latitude ',' position.longitude);
}

function 
handleError(positionError) {
  
alert('Attempt to get location failed: ' positionError.message);
}
geo.getCurrentPosition(updatePositionhandleError);




map.setCenter(new GLatLng(45.81952115.886823), 16); 

Ovaj prvi dio gore mi izbacuje vrijednosti u javascript alert prozoru, koje bi htio spremiti u php varijablu, i onda ju ubacio u ovaj dolje dio umjesto ovih brojeva:
PHP Code:
GLatLng(45.81952115.886823
Znaci ovako nesto sam mislio
PHP Code:
GLatLng(<?php echo $koordinate?>


Znaci ovaj dio
PHP Code:
position.latitude ',' position.longitude 
da mi se spremi u neku varijablu da je mogu kasnije ubaciti.

Da li je to moguce?

Nadam se da ste me skuzili.

Hvala puno i pozdrav.
24-02-2010 04:45 PM
Find all posts by this user Quote this message in a reply
kecko Offline
Forumaš
***

Posts: 645
Joined: Nov 2009
Reputation: 20
Post: #2
RE: Spremanje javascript vrijednosti u PHP varijablu
php je na strani servera a javascript na strani klijenta, najjednostavnije je preko ajaxa, da jednostavno pozoveš php skriptu koja u $_GET parametru prima vrijednost varijable i to pohraniš i naravno moraš imati na umu da se s javascriptom lako izmanipulira i da ti bilo ko može bilo kakvu vrijednost puknut unutra, problem specifični nisam ni gledao, ovo ti je dosta da ako želiš raditi sam riješiš
24-02-2010 07:42 PM
Find all posts by this user Quote this message in a reply
danielvast Offline
Forumaš
***

Posts: 432
Joined: Dec 2009
Reputation: 22
Post: #3
RE: Spremanje javascript vrijednosti u PHP varijablu
Code:
function updatePosition(position) {
  alert(position.latitude + ',' + position.longitude);
  window.location.href = "http://localhost/nesto.php?latitude=" + position.latitude + "&longitude=" + position.longitude;
}
Mozda da probas nesto ovako preko $_GET iskoristis varijable i php-u!

"When all else fails, read the manual."
24-02-2010 07:48 PM
Find all posts by this user Quote this message in a reply
Son Goku Offline
Novi korisnik
*

Posts: 41
Joined: Jan 2008
Reputation: 0
Post: #4
RE: Spremanje javascript vrijednosti u PHP varijablu
Hvala na pomoci obojici.

Uspio sam pomocu $_GET, hvala puno danielvast. [Image: notworthy.gif]
25-02-2010 12:15 PM
Find all posts by this user Quote this message in a reply
Son Goku Offline
Novi korisnik
*

Posts: 41
Joined: Jan 2008
Reputation: 0
Post: #5
RE: Spremanje javascript vrijednosti u PHP varijablu
Isprika, nisam bas upoznat sa tim dodavanjem Reputation-a. Evo sada sam danielvastu dao bod. :)
(This post was last modified: 25-02-2010 01:13 PM by Son Goku.)
25-02-2010 01:12 PM
Find all posts by this user Quote this message in a reply
danielvast Offline
Forumaš
***

Posts: 432
Joined: Dec 2009
Reputation: 22
Post: #6
RE: Spremanje javascript vrijednosti u PHP varijablu
Znam da je off topic ali Hvala vam na rep-u drago mi je sto sam mogao pomoci Palac-gore @ kecko hvala ti na rep-uHappy

"When all else fails, read the manual."
25-02-2010 04:20 PM
Find all posts by this user Quote this message in a reply
kecko Offline
Forumaš
***

Posts: 645
Joined: Nov 2009
Reputation: 20
Post: #7
RE: Spremanje javascript vrijednosti u PHP varijablu
na onome što si zaslužio ne trebaš zahvaljivati :)
25-02-2010 05:42 PM
Find all posts by this user Quote this message in a reply
danielvast Offline
Forumaš
***

Posts: 432
Joined: Dec 2009
Reputation: 22
Post: #8
RE: Spremanje javascript vrijednosti u PHP varijablu
Palac-goreNamigivanje

"When all else fails, read the manual."
(This post was last modified: 25-02-2010 07:10 PM by danielvast.)
25-02-2010 07:09 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)