Solved

adding rows dynamically?

Posted on 2012-03-29
4
296 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 31

Accepted Solution

by:
Marco Gasi earned 100 total points
ID: 37785849
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 110

Assisted Solution

by:Ray Paseur
Ray Paseur earned 75 total points
ID: 37788301
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
ID: 37789084
Thank you very much!
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

733 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