Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML JavaScript

How to call data from database

Javascript coding ..

Moderators: macek, egami, gesf

How to call data from database

Postby thoseareuntruth » Fri Dec 30, 2011 6:50 pm

Good day and happy new year, all :)

Anyway, I need a help.
I have made a table form for inputing and inside the table I made another table which the function is for user can add the components.
(might be you can see the image what is the result, I uploaded one)

I use this script to add rows with javascript:
Code: Select all
function addRowToTable()
  var tbl = document.getElementById('table2');
  var lastRow = tbl.rows.length;
  // if there's no header row in the table, then iteration = lastRow + 1
  var iteration = lastRow;
  var row = tbl.insertRow(lastRow);
  // left cell
  var cellLeft = row.insertCell(0);
  var textNode = document.createTextNode(iteration);
  // right cell
  var cellRightSel1 = row.insertCell(1);
  var sel = document.createElement('select'); = 'component' + iteration;
  // select cell
  var cellRightSel2 = row.insertCell(2);
  var sel = document.createElement('select'); = 'subcomponent' + iteration;
  sel.options[0] = new Option('','');
  sel.options[1] = new Option('#', '');
  var cellRight = row.insertCell(3);
  var el = document.createElement('input');
  el.type = 'text'; = 'point' + iteration;
  el.readonly = 'point';
  el.size = '2';
  //el.onkeypress = keyPressTest;

Then.. when I click the add button at the act number one, row number two is show up and yeah it is working BUT.. no options in the Name and Sub Name column. I mean, I cannot select because there is no data.
(see the image, two.jpg)
With the script in the function add row, how to call data from database? I want the number two look same like number one.

Thanks in Advance.
two.jpg (67.46 KiB) Viewed 389 times
one.jpg (61.52 KiB) Viewed 389 times
New php-forum User
New php-forum User
Posts: 1
Joined: Fri Dec 30, 2011 6:02 pm

Return to JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.