Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>take out the following code out of loop... it creates multiple form tag...</p> <p>print "<code>&lt;form id='form1' name='$a+' method='post' action=''&gt;</code>";</p> <p>Place "<code>&lt;tr&gt;&lt;/tr&gt;</code>" inside the loop...</p> <p>final code looks like:</p> <pre><code>&lt;form id='form1' name='fm1' method='post' action=''&gt; &lt;tr&gt; &lt;?php $sql1="select * from pricelist"; $result1=mysql_query($sql1) or die(mysql_error()); while ($row=mysql_fetch_array($result1)) { $id=$row['id']; $price=$row['h_price']; $a=0; print "&lt;tr&gt;"; print "&lt;td&gt;&lt;input name='fees' value ='$fees' type='text' size='4' /&gt;&lt;/td&gt;"; print "&lt;td&gt;&lt;input name='price' value ='$price' type='text' size='15' /&gt;&lt;/td&gt;"; echo "&lt;td&gt;&lt;input type='checkbox' onclick='this.$a+.disabled = !this.checked;'&gt;&lt;td&gt;"; print"&lt;td&gt;&lt;input type='submit' name='$a+' value='Submit' disabled='disabled' /&gt;&lt;/td&gt;"; print "&lt;/tr&gt;"; } print "&lt;/form&gt;"; ?&gt; </code></pre> <p>Next if u want to control the button only then</p> <pre><code>&lt;input type='checkbox' onclick='document.$a.submit.disabled = !this.checked;' /&gt; </code></pre> <p>and make sure of the following things: 1.) form name should be $a i.e <code>&lt;form name='$a' ...&gt;</code></p> <p>2.) submit buttons name should be submit i.e <code>&lt;input type='submit' name='submit'...&gt;</code></p> <p>3.) increase the $a variable only at the end of loop i.e </p> <pre><code>$a++; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload