I’m looking to be able to edit an individual line in a php loop. I have this script here that I think is almost perfect, except I don’t know how to add the Value to the “PriorityForm”.
<script type="text/jscript">
function PriorityInfo(Value) {
$.post("updatenote.php?ID="+Value, { Note: PriorityForm.Note.value},
function(output) {
$("#Priority"+Value).html(output).show();
});
}
</script>
The (Value) in “PriorityInfo(Value)” changes. I’ve gotten the Value to add to everything but “PriorityForm”. For example, { Note: PriorityForm.Note.value} needs to be { Note: PriorityForm9.Note.value} if the Value is 9. I’ve tried
Note: PriorityForm+ Value.Note.value
Note: PriorityForm+ (Value).Note.value
Note: PriorityForm+ “Value”.Note.value
Note: “PriorityForm”+ Value.Note.value
This cause the JavaScript not to run so I’m pretty sure it’s a syntax error. My mistake, here's the PHP code:
<?php
$info0 = "SELECT * FROM CT:GTMQuestionPoints WHERE Question = 'Priority' AND PointLossNote NOT LIKE ''";
$rs0=odbc_exec($connq,$info0);
while($row = odbc_fetch_array($rs0)) {
$ID = "" . $row["ID"] . "";
$Note = "" . $row["PointLossNote"] . "";
$Points = "" . $row["Points"] . "";
echo '
<table>
<tr>
<td style="width: 700px"><form name="PriorityForm'.$ID.'"><input name="Note" type="text" value ="'.$Note.'" style="width: 700px"></td>
<td style="width: 100px"><input name="Points" type="text" value ="' . $Points . '" style="width: 100px"></td></form>
<td style="width: 180px"><input name="updatepriority" type="button" value="Update" onclick="PriorityInfo(''.$ID.'')"><div id="Priority'.$ID.'"></div></td>
<td style="width: 180px"><form method="POST" action="rmsdeletenote.php?Priority=' . $Note . '"><input name="modify" type="submit" value="Remove"></td></form>
</tr>
</table>
';
}
?>
PriorityForm? Where is it declared, what value does it contain?