How do you mean "embedded JavaScript in php code"? Please make sure that -since Php runs on the webserver and JavaScript only in the browser- your php script can send some JavaScript code (just as it can send html code). But the opposite (using JavaScript to pass values to the php code in the page) is not possible, because by the time the JavaScript executes (in the browser), the php code has already executed and has "vanished" (has been replaced by its results by the webserver).
Passing variables from php to JavaScript is easy, just print the right assignment statement (in the JavaScript language), using a print() or something alike in your PhP code. Please keep an eye on the quotes etc.
Example:
<SCRIPT language="JavaScript">
<?
print("jsvar=".$phpvar.";\n");
?>
</SCRIPT>
(note: you can also print the "<script>" tag in your php code, but that does not change anything. The \n at the end is not required (html code and also JavaScript code does not require \n at the end of a line), but the ";" terminator is required.