Passing data from PHP to JavaScript
<p>I have a simple php variable i need to carry over to a javascript part.</p>

<p>Code:</p>

<pre><code>&lt;?php
if ($p == 'home') { $selected == '0'; }
if ($p == 'music') { $selected == '1'; }
if ($p == 'videos') { $selected == '2'; }
if ($p == 'search') { $selected == '3'; }
if ($p == 'about') { $selected == '4'; }
if ($p == 'contact') { $selected == '5'; }
?&gt;
&lt;script type="text/javascript"&gt;
//SYNTAX: tabdropdown.init("menu_id", [integer OR "auto"])
tabdropdown.init("colortab", $selected) &lt;-- $selected is the variable I want to carry over
&lt;/script&gt;
</code></pre>
