I have a form that generates lots and lots of rows. Each row has an "Add Notes" button like this
<button onclick=\"myFunction()\">Add Note</button>
and it triggers a popup input through this snippet
<script language="JavaScript" type="text/javascript">
function myFunction() {
var x;
var note = prompt("Customer Note","Write your customer note here...");
if (note != null) {
document.getElementById("notes").value = note;
document.getElementById("notesForm").submit();
}
else{
return false;
}
}
</script>
and submits a form through this section
<form action=\"http://calls.fantomworks.com/functions/notes.php\"
id='notesForm' name='notesForm' method='post'>
<input type='hidden' id='ID' name='ID' value='{$row['ID']}' />
<input type='hidden' id='notes' name='notes' />
</form>
The problem is that the note is getting passed to the top row instead of the correct {$row['ID']}. How do I pass the {$row['ID']} through this popup and back to the form so that it will be gotten in the notes processor below correctly??
$notesID = $_POST['ID'];
$note = $_POST['notes'];
$note = mysql_real_escape_string($note);
$date= date('Y-m-d');
$result = mysql_query("UPDATE Project_Submissions SET
Notes=CONCAT(Notes,'<br />".$date." ".$note."')
WHERE ID ='".$notesID."'");
I am so lost and could really use some help here. Thank you so much in advance!!
$noteis NOT enough. you have to escape ALL external data.MYSQLIorPDOextensions for you database access. themysqlextension will soon disappear as it is deprecated. Dont waste your time with it. Learn one of the others, please read stackoverflow.com/questions/12859942/…