Your page should have the layout with some general sections like this:
[PHP code at the top of the page]
<DOC Tag>
<html>
<head>
[code inside head tag]
</head>
<body>
[code inside body tag]
</body>
</html>
You will have to copy the PHP code at the top of the page to the top of the page you are trying to add the functionality to. A PHP code block looks like this:
<?php some code ?>
Make sure there is no whitespace between the php code blocks:
good:
<?php some code ?>
<?php more code ?>
bad:
<?php some code ?>
<?php more code ?>
Having whitespace between the code blocks causes problems.
You will also have to copy the code between <head> and </head> to the corresponding location on your other page and the same with the code between <body> and </body>