Hi all, i don't know how to solve this problem...i want store all the data into database. help pls~ thanks~

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link href="/style.css" rel="stylesheet" type="text/css" />
<title>Insert New Institution</title>
<script type="text/javascript">
function addRowToTable()
{
  var tbl = document.getElementById('tblAddress');
  var lastRow = tbl.rows.length;
  // if there's no header row in the table, then iteration = lastRow + 1
  var iteration = lastRow;
//  var iteration = lastRow + 1;
  var row = tbl.insertRow(lastRow);

  //  cell 0
  var cell0 = row.insertCell(0);
  var el = document.createElement('input');
  el.type = 'text';
  el.NAME = 'Institution Name[]';
  el.size = 30;
  cell0.appendChild(el);

  //cell 1
  var cell1 = row.insertCell(1);
  var el = document.createElement('input');
  el.type = 'text';
  el.NAME = 'Address[]';
  el.size = 50;
  cell1.appendChild(el);

  //cell 2
  var cell2 = row.insertCell(2);
  var el = document.createElement('input');
  el.type = 'text';
  el.NAME = 'Website[]';
  el.size = 30;
  cell2.appendChild(el);

}
</script>
</head>

<body>
<h2>Insert New Institution</h2>

<br /><br /> 
<form action="java3.php" name="" method="post">
 <table id="tblAddress">
                <tr>
                  <td class="txtBase">Institution Name</td>
                  <td class="txtBase">Address</td>
                  <td class="txtBase">Website</td>
                </tr>
               <tr>
                  <td><input name="Institution Name[]" type="text" size="30" maxlength="100"></td>
                  <td><input name="Address[]" type="text" size="50" maxlength="1000"></td>
                  <td><input name="Website[]" type="text" size="30" maxlength="100"></td>
    </tr>
  </table><input type="button" name="Add" value="Add" onClick="addRowToTable();">
               <input type="submit" name="Submit" value="Submit">
</form>


</body>
</html>

Recommended Answers

All 9 Replies

The best is if you make a Form around your Table. After you did that you can send the data to a .php file which does save the array into a Database.
What do you know about all that? Can you do that or do you need more help?

your question makes no sense.

tho if you are talking about storing data from a form into a DB(for example mysql) then just take the data from the form using $_POST form the sql query and perform an INSERT query. Piece of Cake

DO NOT STORE ARRAYS IN THE DATABASE PLEASE

The best is if you make a Form around your Table. After you did that you can send the data to a .php file which does save the array into a Database.
What do you know about all that? Can you do that or do you need more help?

can i need more help?? i really no idea about it..

your question makes no sense.

tho if you are talking about storing data from a form into a DB(for example mysql) then just take the data from the form using $_POST form the sql query and perform an INSERT query. Piece of Cake

DO NOT STORE ARRAYS IN THE DATABASE PLEASE

i means Save array in database.. Can do that???

yes, you can save an array into a database in a field which is varchar(1024) or say text. you can serialize the array and then store, but i dont see the benefit of it anywhere

yes, you can save an array into a database in a field which is varchar(1024) or say text. you can serialize the array and then store, but i dont see the benefit of it anywhere

no other method already?? serialize i tested it before but no work..

not sure about what you mean by "but no work" but i think you are talking abt storing a php array into mysql DB, just serialize the array and store into the DB under a varchar/text column

not sure about what you mean by "but no work" but i think you are talking abt storing a php array into mysql DB, just serialize the array and store into the DB under a varchar/text column

It works but save wrong column at db there...

I done it.. thanks everyone!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.