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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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> Quote Link to comment Share on other sites More sharing options...
srinivas6203 Posted March 19, 2008 Author Share Posted March 19, 2008 Thank you very much Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.