Re: writing to the db on close
| From: | Ns_Andy | Date: | Wed, 05 Feb 2003 14:37:38 +0000 |
| Subject: | Re: writing to the db on close | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-134417@lists.php.net to get a copy of this message | ||
Try the window.open method to popup a php page that does the desired job.
<script>
window.onunload=doRec
function doRec() {
window.open("writeToDB.php")
}
</script>
and writeToDb.php
<?php
//......
?><script>window.close()
</script>
--
Regards,
Ns_Andy, ns_andy@yahoo.com
"Edward Peloke" <epeloke@echoman.com> wrote in message news:NFBBIIKNALMFFNANEKEFMEACDGAA.epeloke@echoman.com...
> Hello,
>
> I need a way to write a record to the db when the user closes their browser.
> How can I do this? I looked last night at the onunload javascript event but
> am not sure how that can trigger the php code to enter a row in the db. I
> am using sessions so is there a way to write to the db when the session is
> deleted?
>
> Thanks,
> Eddie
>