paruby Posted September 7, 2009 Share Posted September 7, 2009 i am trying to create a shopping cart system, like peapod.com, or netgrocer.com. I noticed 2 things that I would like to replicate :: 1. When you change the quantity, the page does not refresh, and 2. the shopping cart on the right frame does update, and refresh. I think I have found how the quantity changes w/out a page refresh, with javascript. but, I can not determine how to (at the same time) update the DB with the new quantity to update the shopping cart. Since I can not call PHP from javascript, I was hoping I could put code on the "onChange" event of the quantity field to only update the DB and only refresh the shopping cart data, again, without having the main page refresh. If you see my code at http://lpbj.net/eshop/, you will see I tried to put a basic alert messagebox on the "onChange" event, but it doesn't always fire (event tried changing the focus)... Anyway, hopefully I can get some help/ ideas on the best way to do this. As a side note, I have seen examples putting all the quantities/products into an array, but my concern is that the user will leave before checking out and saving the data to the DB, and i would like the shopping cart to be dynamically changing... Pete Quote Link to comment Share on other sites More sharing options...
kumarkiranm Posted September 7, 2009 Share Posted September 7, 2009 This you can achieve, using AJAX. check this article http://www.w3schools.com/PHP/php_ajax_database.asp Quote Link to comment Share on other sites More sharing options...
paruby Posted September 8, 2009 Author Share Posted September 8, 2009 Thanx kumarkiranm . That is exactly what I am looking for. And it's a great place to start w/ AJAX. I have been hesitant to get into it, but looks very easy here! Pete Quote Link to comment Share on other sites More sharing options...
pacholo Posted September 9, 2009 Share Posted September 9, 2009 sir/ma'am good day if its day in your place, you may go to http://www.tizag.com/phpT/phpsessions.php if your using php,your using php right?.because the session topic might help you. Quote Link to comment 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.