0
   

how to pass the data inside a table created dynamically using javascript to mysql database

 
 
pinju
 
Reply Tue 23 Feb, 2016 01:32 am
Code:function check(s1){
var list=document.getElementsByName(s1);
for(var i=1; i<list.length; i++){
if(list.checked){
var x=list.value;
}

}
create(x);
}

function create(x){
document.getElementById('form1');
var field=document.createElement('fieldset');
var t=document.createElement('table');
t.setAttribute("id","myTable");
document.body.appendChild(t);
field.appendChild(t);
document.body.appendChild(field);

var row=document.createElement('th');
newHeader = document.createElement("th");
newHeader.innerText = x;
row.appendChild(newHeader);


var row1=document.createElement('tr');
var col1=document.createElement('td');
var col2=document.createElement('td');

var row2=document.createElement('tr');
var col3=document.createElement('td');
var col4=document.createElement('td');

var row3=document.createElement('tr');
var col5=document.createElement('td');
var col6=document.createElement('td');

var row4=document.createElement('tr');
var col7=document.createElement('td');
var col8=document.createElement('td');

var row5=document.createElement('tr');
var col9=document.createElement('td');
var col10=document.createElement('td');

col1.innerHTML="Name";
col2.innerHTML="<input type='text' name='stateactivityname' size='40' required>";
row1.appendChild(col1);
row1.appendChild(col2);
col3.innerHTML="Registration Applicable";
col4.innerHTML="<select name='regapp' required><option></option><option>Yes</option><option>No</option></select>";
row2.appendChild(col3);
row2.appendChild(col4);
col5.innerHTML="Registers Applicable";
col6.innerHTML="<select name='registers' required><option></option><option>Yes</option><option>No</option></select>";
row3.appendChild(col5);
row3.appendChild(col6);
col7.innerHTML="Sublocation";
col8.innerHTML="<select name='sub' required><option></option><option>Yes</option><option>No</option></select>";
row4.appendChild(col7);
row4.appendChild(col8);

col9.innerHTML="Central or State";
col10.innerHTML="<select name='cors' required><option></option><option>central</option><option>state</option></select>";
row5.appendChild(col9);
row5.appendChild(col10);

t.appendChild(row);
t.appendChild(row1);
t.appendChild(row2);
t.appendChild(row3);
t.appendChild(row4);
t.appendChild(row5);

addrow('myTable');

}


i have a JavaScript code, in that code table is created dynamically when a check box is clicked. and the values inside the table are obtained using PHP code . is there a way to pass these values inside JavaScript to database.?
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 892 • Replies: 0
No top replies

 
 

Related Topics

 
  1. Forums
  2. » how to pass the data inside a table created dynamically using javascript to mysql database
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 04/26/2024 at 08:52:35