storing user input into a table
2 posters
Page 1 of 1
storing user input into a table
ok so I've got this code:
adding new rows and deleting them works fine, but when I refesh the page, everything is reset.
I realise this is because the data being input isnt being sent to a db, so i was wondering if it was possible to do it any other way, OR by linking ir to an off site db, then calling that database back for input?
question breakdown: what should i do to my code to make the inputs stay there permanently?
NOTE: this is a ban list to keep track of bans other than my forums bans. eg a TF2 server ban list.
- Code:
<HTML>
<HEAD>
<TITLE> Add/Remove dynamic rows in HTML table </TITLE>
<SCRIPT language="javascript">
function addRow(tableID) {
var table = document.getElementById(tableID);
var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
var cell1 = row.insertCell(0);
var element1 = document.createElement("input");
element1.type = "text";
cell1.appendChild(element1);
var cell2 = row.insertCell(1);
var element2 = document.createElement("input");
element2.type = "text";
cell2.appendChild(element2);
var cell3 = row.insertCell(2);
var element3 = document.createElement("input");
element3.type = "text";
cell3.appendChild(element3);
var cell4 = row.insertCell(3);
var element4 = document.createElement("input");
element4.type = "text";
cell4.appendChild(element4);
var cell5 = row.insertCell(4);
var element5 = document.createElement("input");
element5.type = "text";
cell5.appendChild(element5);
var cell6 = row.insertCell(5);
var element6 = document.createElement("input");
element6.type = "text";
cell6.appendChild(element6);
var cell7 = row.insertCell(6);
var element7 = document.createElement("input");
element7.type = "checkbox";
cell7.appendChild(element7);
}
function deleteRow(tableID) {
try {
var table = document.getElementById(tableID);
var rowCount = table.rows.length;
for(var i=0; i<rowCount; i++) {
var row = table.rows[i];
var chkbox = row.cells[6].childNodes[0];
if(null != chkbox && true == chkbox.checked) {
table.deleteRow(i);
rowCount--;
i--;
}
}
}catch(e) {
alert(e);
}
}
</SCRIPT>
</HEAD>
<BODY>
<INPUT type="button" value="Add Row" onclick="addRow('dataTable')" />
<INPUT type="button" value="Delete Row" onclick="deleteRow('dataTable')" />
<TABLE id="dataTable" border="1">
<TR>
<TD width="160px"> I </TD>
<TD width="160px"> banned </TD>
<TD width="160px"> because of </TD>
<TD width="160px"> for </TD>
<TD width="160px"> on the </TD>
<TD width="160px"> remaining time </TD>
<TD width="40px"> Delete? </TD>
</TR>
</TABLE>
</BODY>
</HTML>
adding new rows and deleting them works fine, but when I refesh the page, everything is reset.
I realise this is because the data being input isnt being sent to a db, so i was wondering if it was possible to do it any other way, OR by linking ir to an off site db, then calling that database back for input?
question breakdown: what should i do to my code to make the inputs stay there permanently?
NOTE: this is a ban list to keep track of bans other than my forums bans. eg a TF2 server ban list.
shark7- New Member
- Posts : 24
Reputation : 0
Language : English
Re: storing user input into a table
for anyone who was wondering how i solved this ... i set up a google spreadsheet/ form, then used the <iframe> tage to crate a submission page and a table view page.
IM me if you want more info
IM me if you want more info
shark7- New Member
- Posts : 24
Reputation : 0
Language : English
Re: storing user input into a table
Solved -> Locked
Jophy- ForumGuru
- Posts : 17924
Reputation : 836
Language : English
Location : Somewhere
Similar topics
» STORING IP ADDRESSES
» Money storing
» Forum not Storing Cookies
» Storing Calendar Threads in Basket?
» Changing table font color and table side
» Money storing
» Forum not Storing Cookies
» Storing Calendar Threads in Basket?
» Changing table font color and table side
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum