Solved

adding rows dynamically?

Posted on 2012-03-29
4
301 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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

729 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