dragongamer Posted April 10, 2006 Share Posted April 10, 2006 ok i want to make it so i can insert the time some one spent on a page in to a mysql data base the code i have is[code] <script language="javascript" type="text/javascript"> <!-- BeginpageOpen = new Date();function bye() {pageClose = new Date();minutes = (pageClose.getMinutes() - pageOpen.getMinutes());seconds = (pageClose.getSeconds() - pageOpen.getSeconds());time = (seconds + (minutes * 60));if (time == 1) {time = (time + " second");}else {time = (time + " seconds"); }alert('It has been ' + time + '. ');}window.onunload = bye;// End --></script>[/code]how can i turn the java var ' + time + ' and make it into a in a $statment. Quote Link to comment https://forums.phpfreaks.com/topic/7016-java-and-php-call/ Share on other sites More sharing options...
trq Posted April 10, 2006 Share Posted April 10, 2006 Php runs on the server so cannot mix with java[b]script[/b] (client-side) as you have descibed. You will need to have the javascript code request your php script from the server, or maybe look into using ajax. Quote Link to comment https://forums.phpfreaks.com/topic/7016-java-and-php-call/#findComment-25496 Share on other sites More sharing options...
dragongamer Posted April 10, 2006 Author Share Posted April 10, 2006 ohh do you know of a php script that can genarate the time you have been on a cetian page? Quote Link to comment https://forums.phpfreaks.com/topic/7016-java-and-php-call/#findComment-25509 Share on other sites More sharing options...
trq Posted April 10, 2006 Share Posted April 10, 2006 You could do it with a custom session handler, but its no simple script. Quote Link to comment https://forums.phpfreaks.com/topic/7016-java-and-php-call/#findComment-25536 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.