1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
| <script>
function start() {
// get the reference for the body
var body = document.getElementsByTagName("body")[0];
// creates a <table> element and a <tbody> element
//var tbl = document.createElement("table");
var tbl = document.getElementById("table");
var tblBody = document.createElement("tbody");
// creating all cells
//for (var j = 0; j < 2; j++) {
// creates a table row
var row = document.createElement("tr");
//for (var i = 0; i < n; i++) {
// Create a <td> element and a text node, make the text
// node the contents of the <td>, and put the <td> at
// the end of the table row
var cell_1 = document.createElement("td");
var cell_2 = document.createElement("td");
var cell_3 = document.createElement("td");
var cell_4 = document.createElement("td");
var cell1=document.createElement("input");
cell1.type="text";
cell1.name="fname";
cell1.size="20";
cell1.maxlength="50";
//cell1.style="background:#FFFFCC";
cell_1.appendChild(cell1);
var cell2=document.createElement("textarea");
cell2.name="fdescription";
cell2.rows="2";
cell2.cols="30";
//cell2.wrap="hard";
cell_2.appendChild(cell2);
var cell3 = document.createElement("a");
cell3.setAttribute("href","delete.php");
cell3.appendChild(document.createTextNode("[Delete]"));
cell_3.appendChild(cell3);
var cell4 = document.createElement("a");
cell4.setAttribute("href","delete.php");
cell4.appendChild(document.createTextNode("[Delete]"));
cell_4.appendChild(cell4);
row.appendChild(cell_1);
row.appendChild(cell_2);
row.appendChild(cell_3);
row.appendChild(cell_4);
// }
// add the row to the end of the table body
tblBody.appendChild(row);
//}
// put the <tbody> in the <table>
tbl.appendChild(tblBody);
// appends <table> into <body>
body.appendChild(tbl);
// sets the border attribute of tbl to 2;
tbl.setAttribute("border", "1");
}
</script>
<form>
<table align="center" border = "2" cellspacing ="0" cellpadding="3" id="table">
<tr><td><b>Functionality Name:</b></td> <td><b>Description:</b></td> <td><b>Status:</b></td> <td><input type="submit" value="Add Functionality" onclick='start();'></td></tr>
</table>
</form>
<?php
require_once ('../mysqli_connect.php');
echo '<select name="fstatus" style="width: 150px">';
// Retrieve all the statuses of a functionality
$q = "SELECT F_status_ID, Functionality_status FROM fstatuses ORDER BY F_status_ID ASC";
$r = mysqli_query($dbc, $q);
if (mysqli_num_rows($r) > 0) {
while ($menu_row = mysqli_fetch_array($r, MYSQLI_NUM)) {
echo "<option value=\"$menu_row[0]\">$menu_row[1]</option>\n";
}
}
echo '</select>';
mysqli_free_result($r);
unset($menu_row);?> |
Partager