Javascript PHP : Droplist is not changing label according to its selection
<p>I wrote following code:</p>

<pre><code>function chkDiscount()
  {
    $pckg_value = 0;
    plan = document.getElementById("PFirst").value; 
    if (plan === "Year") { 

        document.getElementById("discount").innerHTML = "15% discount";
        &lt;?php
            $pckg_value = ($pckg_cost - 15) * 12; 
        ?&gt;

    }
    if (plan === "HalfYear") { 

        document.getElementById("discount").innerHTML = "10% discount";
        &lt;?php
            $pckg_value = ($pckg_cost - 10) * 6; 
        ?&gt;
    }
    if (plan === "Quarter") { 

        document.getElementById("discount").innerHTML = "5% discount";
        &lt;?php
            $pckg_value = ($pckg_cost - 5) * 3; 
        ?&gt;
    }
  }
</code></pre>

<p>I m using the $pckg_value in rest of the code.But its shows me same value on each selection.i.e. alwayes shows value calculated in last if block.Please help me to show right calculation on each selection.Please help.</p>
