marubinkun Posted March 5, 2010 Share Posted March 5, 2010 Hello guys, I have an issue, a big one in fact, 'cos i want to link dynamically a checkbox with a specific text-box field in a dynamic table generated from a sql script. If i check a checkbox the value of the text-box next to it must change to zero (0). And since the name of the check and text-boxes are arrays because after the submit it goes to another dynamic table. Any help?? Thanks Link to comment https://forums.phpfreaks.com/topic/194240-checkbox-in-a-dynamic-table-with-text-box-fields/ Share on other sites More sharing options...
greatstar00 Posted March 5, 2010 Share Posted March 5, 2010 can u show the code? show how the checkbox, text-field array looks like Link to comment https://forums.phpfreaks.com/topic/194240-checkbox-in-a-dynamic-table-with-text-box-fields/#findComment-1021907 Share on other sites More sharing options...
marubinkun Posted March 5, 2010 Author Share Posted March 5, 2010 Here you are and thanks in advanced.... BTW, this application is an order/inventory via web. This form features the product selection from a dynamic catalogue and the client must write the quantity and I'd like to manage that the quantity shouldn't stay in blank or null before submitting. Thanks again, anything else be free for asking... ************************************************************* <form action="xxxxx.php" method="post" enctype="multipart/form-data" name="xxxx" id="xxxxxx"> <div align="left"> <h1 align="center">Lista de productos </h1> <table width="460" border="1" align="center"> <tr> <td width="130" height="23"><div align="center">Code</div></td> <td width="177"><div align="center">Name</div></td> <td width="131"><div align="center">Picture</div></td> <td width="77"><div align="center">Selection</div></td> <td width="77"><div align="center">Quantity</div></td> </tr> <?php $link = mysql_connect('host','user','password'); $db_selected = mysql_select_db('database', $link); $ftch='select * from xxxxxxxx'; $result=mysql_query($ftch); while ($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td><div align='center'>".($row['codigo'])."</td>"; echo "<td><div align='center'>".$row['producto']."</td>"; echo "<td><div align='center'>"."<img src=".$row['foto']." width='118' height='87'/>"."</td>"; echo "<td><div align='center'><input type='checkbox' name='prod[]' value =".$row['codigo'].">"."</div></td>"; echo "<td><div align='center'>"."<input type='text' name='cantidad[]' border='0' value ='0' maxlength='2' size='2'>"."</td>"; echo "</tr>";} mysql_close($link); ?> </table> <p align="center"> <label> <input type="submit" name="send" id="send" value="Enviar" /> </label> <label> <input type="reset" name="clean" id="clean" value="Limpiar" /> </label> </p> </div> </form> ************************************************************* Link to comment https://forums.phpfreaks.com/topic/194240-checkbox-in-a-dynamic-table-with-text-box-fields/#findComment-1021912 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.