Jump to content

Checkbox in a dynamic table with text-box fields


marubinkun

Recommended Posts

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

 

 

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>

*************************************************************

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.