Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

adding rows dynamically?

Posted on 2012-03-29
4
Medium Priority
?
310 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 31

Accepted Solution

by:
Marco Gasi earned 400 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 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 300 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

916 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