I have dynamic field names that are being posted to my form processor. The names are formatted like editnote|9
. |9
being the ID of the note to edit. If I use this code:
foreach($_POST as $key) {
$editcheck = explode('|', $key);
if($editcheck[0] == 'editnote') {
echo $editcheck[1];
}
}
I can properly get the ID of 9, but I cannot get the value. I have tried:
foreach($_POST as $key => $value) {
$editcheck = explode('|', $key);
if($editcheck[0] == 'editnote') {
$clsCNA->updatenote($editcheck[1], $_POST[$key]);
}
}
But with this code, I can only get the value and not the key name to get the note ID I want to edit.
So basically, I want foreach($_POST as $key => $value)
to somehow allow me to get the name of $key
so I can explode it to get the ID number.
Any ideas?
I am trying to send to my class like this:
$clsCNA->updatenote(ID From key name, Value of key)