chandler Posted March 3, 2012 Share Posted March 3, 2012 Hi guys, can someone help me with this please. I had this form script made for me but I would like to make some small changes, below is the part I'd like to make changes to. I want to put a <td> tag to the following elements - (<th>Extras</th>, <td>title</td>, <td>checkbox</td>, <td>personNumber</td>) so that they are all in their own cell. The problem I have is once a new row is made in the form table I am unsure how to make it add the <tr> with php for the new row. what I get once adding the <td> tags is: <th>Extras</th> title checkbox, personNumber title checkbox personNumber what I want is <th>Extras</th> title, checkbox, personNumber title, checkbox, personNumber Here is the code, many thanks for your help! <table> <tr> <td><?php echo $AB_LANGS['Extras']; ?></td> <td align="right"> <?php while ($ExtrasData = mysql_fetch_assoc($sql_result)) { ?> <?php echo $ExtrasData['title']; ?> <input type="checkbox" name="extra_id" id="extra_id" value="<?php echo $ExtrasData['id'] . ':' . $ExtrasData['per'] . ':' . $ExtrasData['price']; ?>" onclick="addExtras()"> <?php if ($ExtrasData['per'] == 'person') { ?> <select name="personNumber_<?php echo $ExtrasData['id']?>" id="personNumber_<?php echo $ExtrasData['id']?>" onchange="addExtras()"> <?php for($i = 0; $i <= 10; $i++) { ?> <option value="<?php echo $i; ?>"><?php echo $i; ?></option> <?php } ?> </select> <?php } ?> <br/> <?php } ?> </td> </tr> </table> Link to comment https://forums.phpfreaks.com/topic/258202-php-form-table-help-pls/ Share on other sites More sharing options...
S3cr3t Posted March 4, 2012 Share Posted March 4, 2012 You will need a counter to indicate there are 3 <td>s so that script puts a </tr><tr> in it and then reset the counter to continue with the <td>s. Link to comment https://forums.phpfreaks.com/topic/258202-php-form-table-help-pls/#findComment-1323769 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.