Is intergrating php with javascript a smart idea, I've been working on a few scripts lately and don't quite understand how the two completely different languages combine and work? Since i've never learnt java, can someone maybe help me out?
Lol, okay that's a bit better. You have to know that these languages are two totally different things, and you can't always necessarily "combine" them. You have to be way more specific about what you want to do. We can't help you with the information you've provided. Also, some code you're working with would be nice...
Well, I'm just experimenting with my partner's sites and he's had a programmer do some work for him lately, however the programmer included javascript with php, just totally out of the blue, I'm not really looking how to script it or anything. I'm just interested because knowing the fact they are two different languages, how they can kind of fit in and work? More so, I'm wishing to learn how java and php can mix together, to prove my knowledge as a programmer
There are millions of cases I can think of. I don't know what to tell you unless you're more specific. Javascript is a browser language. The server treats it just like HTML and the only thing it does is send it to the browser. Then the browser itself does all the "magic". PHP is only server based. The server parses it, and convert the whole PHP code in HTML/CSS or whatever else you tell it to do. And after parsing the code, THEN it sends it to the browser. So... First runs PHP -> HTML and Javascript will be sent to browser -> Browser parses HTML and Javascript. You can use PHP to dynamically create/modify Javascript code BEFORE sending it to the browser. <script> alert('<?php echo 'Your message depending on server settings, for example.'; ?>'); </script> PHP: <?php if (/* some condition */) { $foo = 'hello'; } else { $foo = 'world'; } ?> <script> var foo = '<?php echo $foo; ?>'; alert(foo); </script> PHP: (Also note that Java is not Javascript. When you say Java, you usually refer to Sun's Java.)