How can I make the tempInput.value set to the php echo statement. I am storing each value in a session, but when I do it this way or using setAttribute(), it only places the php statement directly in the input box.
This is the code I am using:
Code:
function HDonCallReport_addCallsRecieved()
{
var tbody = document.getElementById('CallsReceived').getElementsByTagName("TBODY")[0];
var row = document.createElement("TR"); // create a new table row
var td = new Array(4); // counting the table we made there are 8 cells per table row
var tempSelect;
var tempInput;
var rownum = tbody.rows.length; // not +1 because we have a header row
// Create Time select box
td[0] = document.createElement("TD"); // create a td element
tempInput = document.createElement("INPUT"); // create an input
tempInput.name = "Time_" + rownum; // name the input
tempInput.id = "Time_" + rownum; // give an id to the input
tempInput.size = 20; // set the size of the input
tempInput.value="<?php echo htmlentities($_POST['Time_']); ?>";
tempInput.onblur = "validateTimePicker(this)";
td[0].appendChild(tempInput); // add the select box to the table cell
// Create Location input
td[1] = document.createElement("TD"); // create a table cell
tempInput = document.createElement("INPUT"); // create an input
tempInput.name = "Location_" + rownum; // name the input
tempInput.id = "Location_" + rownum; // give an id to the input
tempInput.size = 30; // set the size of the input
td[1].appendChild(tempInput); // add the input to the table cell
// Create Who Called input
td[2] = document.createElement("TD");
tempInput = document.createElement("INPUT");
tempInput.name = "WhoCalled_" + rownum;
tempInput.id = "WhoCalled_" + rownum;
tempInput.size = 30;
td[2].appendChild(tempInput);
// Create Response input
td[3] = document.createElement("TD");
tempInput = document.createElement("textarea");
tempInput.name = "Response_" + rownum;
tempInput.id = "Response_" + rownum;
tempInput.rows = 2;
tempInput.cols = 30;
td[3].appendChild(tempInput);
// Append each cell to the row we created row
for(i=0; i<4; i++)
row.appendChild(td[i]);
// Append row to table so that it appears on screen
tbody.appendChild(row);
// Increment the number of Code rows
document.CallsReceived.CodeCount1.value = parseInt(document.witness.CodeCount1.value) + 1;
}
and this is what I want
[HTML]
<td >
<input id="Time_1" name="Time_1" size="20" value="<?php echo htmlentities($_POST['Time_1']); ?>" onblur="validateTimePicker(this)" />
<img src="gif/timepicker.gif" align="top" onclick="selectTime(this,Time_1);" STYLE="cursor:hand" />
</td>