Mixing PHP with javascript?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Sepsis2x
Forum Newbie
Posts: 6
Joined: Fri Jun 13, 2008 3:32 pm

Mixing PHP with javascript?

Post 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?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Mixing PHP with javascript?

Post 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.
(#10850)
Sepsis2x
Forum Newbie
Posts: 6
Joined: Fri Jun 13, 2008 3:32 pm

Re: Mixing PHP with javascript?

Post 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.
Post Reply