time problem?..javascript+php variable

A

Anonymous

Guest
You mean you want to store javascript variable into php variable and write it into database? WHY??? Anyway - if you can't (or don't want to) do it with submitting a html form with that input, you should use AJAX (or something AJAX-like - iframes, script objects..).
 
I can imagine that you want to use the visitor's time - to allow for time zones - but yes, you have to send the data to your PHP script.

A possible option is to load the PHP script as an image in javascript. The script doesn't actually have to return an image, it just means that the browser will load the response into memory.

Code:
var fakeImage = new Image();
fakeImage.src = '/thescript.php?time=' + timeValue;

Coditor
 
Back
Top