onUnload event and using with form

J

Jacqueline

Hi,

I am using Javascript and PHP as the server side language with a MySQL
database, and testing under IE6. On the website (www.cooljools.biz),
I have a form which is basically a list of items with a button next to
each one to allow the customer to add or remove the item from their
shopping cart.

Each time the user adds or removes an item, that item is stored, or
removed from respectively a Javascript array. I also have a frame on
the left which gives the customer an easy way to navigate the site.
What I need to do is run some PHP when the user clicks on one of the
buttons in the frame.

However, because the user could press any of the buttons, adding the
code to the beginning of all of these files seems like going the long
way round the problem, so I started looking at the onUnload event.

The onUnload event fires when the user clicks on one of the buttons
(therefore sending the document.location to a new place), however in
between I need to run the PHP. PHP can (as far as I am aware) only be
run from submitting a form so this would be sending the
document.location to the current page.

The computer therefore avoids the PHP form, and goes straight to the
new page probably because it got that call first. I need to know how
to stop it and ensure it runs the PHP stuff before it gets to the page
clicked on.

Hope this all makes sense.

Thanks!!

Jacqueline
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top