Mëòv î‰çîÎ òsyïn wrote:
> Is it posible to get values from javascript to PHP? Without having to post
> the variables..
>
> Thanks //Mårten
>
> _________________________________________________________________
> Chatta med vänner online, prova MSN Messenger: http://messenger.msn.se
I'm not quite sure what you are trying to do. Javascript is executing on the
browser, php executes on the server, therefore to get anything from the
Javascript to php your browser will have to communicate with the server via a
request. This could be a form submission, which might be a POST or a GET.
Alternatively, it is also possible to send data to a php script via a url e.g.
myscript.php?myfield=myvalue. That means that wherever you can get Javascript
to cause the browser to issue a request for a url, if the target at the other
end is a php script then you can send data to that script.
I don't know what you are trying to do, and this is all pretty obscure stuff,
but you could for example put a hidden 1x1 image in the page and then get your
Javascript to change the location of this image to be a php script with a
variable passed on e.g. something like
dummyimage.location = "/myscript.php?myfield="+myjsvalue;
As long as you get the php to send back another empty 1x1 pixel, e.g. via a
header("Location: 1x1pixel.gif"), then your browser page will stay the same as
ever.
As it happens I do sometimes do just this in Javascript but it's to get a new
dynamic image back without reloading a page. Go to
http://tandridge.cpfc.co.uk/tables/0222/graph/2/d7 and then select something
different in the Team 1 or Team 2 selection box, and watch the graph at the
bottom of the page to see this happen. In the source look for the Javascript
function chteam_id() to see how it's done here.
Good luck,
George
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php