srinivas6203 Posted March 17, 2008 Share Posted March 17, 2008 Hi all I want some add table rows script I want to add rows to the table based on the limit. Meamns there is a input field. If i enter in that field as 3 and click add rows, then 3 rows only will be add. If 2 , 2 rows will be add. Can u send me that script anyone. Thanx Link to comment https://forums.phpfreaks.com/topic/96527-add-table-rows/ Share on other sites More sharing options...
dmccabe Posted March 17, 2008 Share Posted March 17, 2008 Something like: <table> <?php $a = 0; while ($a < $yourinput) { echo "<tr><td>yourstuff</td</tr>"; $a++; } ?> </table> $yourinput wants to be wherever your script stores inputted number of table rows. Link to comment https://forums.phpfreaks.com/topic/96527-add-table-rows/#findComment-493943 Share on other sites More sharing options...
srinivas6203 Posted March 17, 2008 Author Share Posted March 17, 2008 Thanx for ur assistance. If u dont mind Can u send script in detail Link to comment https://forums.phpfreaks.com/topic/96527-add-table-rows/#findComment-493946 Share on other sites More sharing options...
dmccabe Posted March 17, 2008 Share Posted March 17, 2008 ok dokey, it's a little crude but here you go: <html> <head> </head> <body> <form name="test" method="get" action="<?php echo $PHP_SELF; ?>"> No of Rows: <input type="text" name="no_of_rows"><br/> <input type="submit" value="Submit"> </form><br /> <?php if ($_GET['no_of_rows']) { $no_of_rows = $_GET['no_of_rows']; $a = 0; echo "<table>"; while ($a < $no_of_rows) { echo "<tr><td>This is row $a</td></tr>"; $a++; } echo "</table>"; } ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/96527-add-table-rows/#findComment-493994 Share on other sites More sharing options...
srinivas6203 Posted March 19, 2008 Author Share Posted March 19, 2008 Thank you very much Link to comment https://forums.phpfreaks.com/topic/96527-add-table-rows/#findComment-495678 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.