Error while passing series of numbers as a parameter to a JavaScript function in PHP
<p>Here's my PHP code - </p>

<pre><code>for ($i=1;$i&lt;=10;$i++)
{
   $numbers .= $i."\n";
}
echo "&lt;input type='button' onclick=ShowNumbers('$numbers') value='Show Numbers'&gt;";
</code></pre>

<p>And my Javascript code - </p>

<pre><code>function ShowNumbers(numbers)
{
   alert("Numbers:: "+numbers);
}
</code></pre>

<p>But when I click on the button <strong>Show Numbers</strong>, nothing happens. Whats going wrong ?</p>

<p>When in FireBug I check the button element it shows - </p>

<pre><code>&lt;input type="button" value="Show Numbers" ');="" 10="" 9="" 8="" 7="" 6="" 5="" 4="" 3="" 2="" onclick="ShowNumbers('1"&gt;
</code></pre>

<p>may be thats where the problem lies. How do I get it in right format?</p>
