Quote:
|
Originally Posted by thewickedjester
Very begginner question:
Why PHP/JavaScript?
PHP is server side, while JavaScript is client side, meaning that JavaScript can make popups and other things happen on someones PC, while PHP is server-side, so it does stuff with the server.
|
PHP and JavaScript can be used together also (you can put <?php echo whatnot ?> in <SCRIPT> tags, just as you can put <script>some js here</script> in <?php ?> tags (with the echo before each js command, of course)
PHP is used to load a page and can be put into certain js variables etc (for instance taking items from a database and putting them into js variables, you would use php in script tags OR if you want to make a certain part of your page scale to the length of your database but have JS inside of it, you would use php to make the length of whatever it is (say <TD>s) and put JavaScript inside each TD.
Just because JS and PHP are client-side and server-side respectively does not mean they cannot be used together. JS makes pages dynamic (on the client side) while PHP makes pages dynamic (on the server side, when the page actually loads (the user does not see how the php affects the page)).