so i have two files index.php and footer.php. and i want to add a jquery script to my index.php. so i did this and it works fine:
index.php

<html>
<body>
    <script type = "text/javascript" src = "JQUERY/jquery.js"></script>

<?php
include("include/footer.php");
?>

footer.php

        <script type = "text/javascript" src = "JQUERY/jquery.js"></script>

</body>
</html>

problem is that why do i need to add same script two times? should i just add jquery script only in footer.php. and since iam adding include in index.php. it should add the script too. for ex:
index.php

<html>
<body>

<?php
    include("include/footer.php");
?>

footer.php

        hellowworld 
        <script type = "text/javascript" src = "JQUERY/jquery.js"></script>

</body>
</html>

but this doesnt work and i cant seem to find out why?
note inlude tag is working right. it does print helloworld in index.php

How do you know it's not working? What other jQuery are you running that isn't working?
Any jQuery code you run needs the jQuery library to already be included before the code can function. Therefore you have 2 options:
Place the code after your <script src...> tag
Or make the code execute once the rest of the document is finished loading (recommended):

$(document).ready(function() {
    // Your jQuery code here
});

On a side note, a shorthand way to write the code above is:

$(function() {
    // Your jQuery code here
});

yes my jquery code is in $(document).ready(function(){});

but still doesnt work.

Any reason why you aren't adding the jQuery script reference in your index page, put within the head element, after your style element?

to repeat and clarify a little

<html><head>
<!--
put all your js/css includes here

then put your $(document).ready(function(){}); here
-->
</head><body>
<!--
content goes here
-->
</body></html>

i dont claim its the best way to do it but this check this post
Simple PHP templates

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.