Page 1 of 1

Mixing PHP with javascript?

Posted: Mon Jul 28, 2008 12:33 pm
by Sepsis2x
I'm working on a ecommerce page for my employer. This is my first real experience with PHP, so I don't even know if this is going to be possible.

So here's my problem. After the customers select the product they want, it takes them to a page where it shows them what they purchased, with the price. Under that, my boss want them to be able to select a shipping option. Under that will be the total. What I'm looking to do is get the total to automatically update when the customer selects their delivery option. I know PHP is serverside, so I don't think that it will be able to do that for me. So I think I need to use javascript. Only problem is all my variables are in PHP. Is there any way around this? Or can I some how use PHP variable with javascript?

Re: Mixing PHP with javascript?

Posted: Mon Jul 28, 2008 12:59 pm
by Christopher
Generate javascript with the variables you need. PHP is a language to generate HTML, Javascript, CSS, images ... anything that can be used by the browser.

Re: Mixing PHP with javascript?

Posted: Mon Jul 28, 2008 2:24 pm
by Sepsis2x
I'm not sure how I would go about that. Could you explain more, or do you know of an online tutorial that could explain more? I tried searching google for more info, but I didn't find anything, because I really don't know what I'm doing.