Solved

adding rows dynamically?

Posted on 2012-03-29
4
291 Views
Last Modified: 2012-03-30
I am looking to add rows dynamically to a table and would like to know how I can do this? I choose the number of rows with a radio button and once I hit the submit button I would like to have a table with the specified number of rows with 8 columns and check box in the cell. Please let me know how I can do this. Thanks for the help.

A
addRow.html
addRow2.php
0
Comment
Question by:aej1973
4 Comments
 
LVL 30

Accepted Solution

by:
Marco Gasi earned 100 total points
Comment Utility
You have to use a loop like this:

<?php
if (isset($_POST['Submit'])){
      $num_rows = $_POST['RadioGroup3'];
      echo "<table>";
      for ($i = 0; $i < $num_rows; $i++>){
            echo "<tr>";
            echo "<td></td>>";
            echo "<td></td>>";
            echo "<td></td>>";
            echo "<td></td>>";
            echo "<td></td>>";
            echo "</tr>";
      }
      echo "</table>";
}
?>

Cheers
0
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 75 total points
Comment Utility
Just a quick look a the HTML and PHP suggest to me that you might be able to get a better design if you use one of the jQuery automations for dates.  You might also want to learn about using arrays in both HTML forms and PHP.

Some jQuery information here:
http://jqueryui.com/demos/datepicker/

PHP arrays:
http://us2.php.net/manual/en/language.variables.basics.php
http://us2.php.net/manual/en/language.variables.external.php
http://us2.php.net/manual/en/language.types.array.php
http://us2.php.net/manual/en/array.sorting.php

HTML checkboxes:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_5450-Common-Sense-Examples-Using-Checkboxes-with-HTML-JavaScript-and-PHP.html
0
 

Author Comment

by:aej1973
Comment Utility
Thank you very much!
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn how to dynamically set the form action using jQuery.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now