You don't have to put your javascript in your php code at all for what you are doing. Just make sure your PHP is code is inside
<?PHP
//YOUR PHP CODE HERE
?>
//Javascript code here: like:
<input type="button" value"nope" onclick="javascipt:close()">
<?PHP
//More php code here
?>
Also echo is generally preferred and faster than the print function in php. For more info visit here:
http://dynacker.dotgeek.org/printvsecho/
----------------
Never bother to learn something not knowing which does not do you any harm, and never neglect to learn something whose negligence will increase your ignorance - Imam Jafar Sadeq