how can I really set a php var from javascript var?
Posted: Thu Aug 10, 2006 2:15 pm
I am trying to get stats (browser, version, resolution) using javascript - and then trying to save them as php variables
for example
I suppose it works, but it doesnt really write the data--- it just holdes the javascript that does the check... so when I echo it, it works, but it only works because it is doing the javascript test.
Is there any way I can actually write that data to a variable?
I want to pass along the browser, version, and screen resolution to my FileMaker database- and since FileMaker isn't a browser, I pass along this for browser:
Does this make sense? How can I get it to actually get the browser and copy the actual text to a variable?
for example
Code: Select all
<script language="JavaScript">
var res= (screen.width+"x"+screen.height)
var browser=(navigator.appName)
var version= (navigator.appVersion)
</script>Code: Select all
$resolution = "?> <script language=javascript>document.write(res);</script><?php";
$resolution = str_replace("?>", "", $resolution);
$browser = "?> <script language=javascript>document.write(browser);</script><?php";
$browser = str_replace("?>", "", $browser);
$version = "?> <script language=javascript>document.write(version);</script><?php";
$version = str_replace("?>", "", $version);Is there any way I can actually write that data to a variable?
I want to pass along the browser, version, and screen resolution to my FileMaker database- and since FileMaker isn't a browser, I pass along this for browser:
Code: Select all
<script language=javascript>document.write(browser);</script><?php