Thanks for your interest, but either I’m not understanding your logic, or I was unable to explain what I need in the first post.
If you check my example, I don’t just want to get the “field name”… i NEED the field name to get it’s current value, and with that, act accordingly to verify and validate the form.
I believe you suggest something like this:
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Mytable" AND TABLE_SCHEMA=‘MySchema’,
This gives me the field names…but as you might see in my example, I already know the names… I need to dynamically use those names to theck the current field’s value
I am currently doing this verification, with more than 25 if’s and "switch"s… but with a code just as my example, I can do the same in just a few lines…
What I’m trying to do is learn a way to optimize my code, since that ammount of conditional checks should be really unnecessary.
The following would be a crude and somewhat useless code, but should illustrate my example… just think that instead of 5 fields, I have 30 for which I need to count value occurences which will validate the form.
Example (assume variables are initialized):
$arrayFieldNames = array(“fieldName1”,“fieldName2”,“fieldName3”,‘fieldName4’, ‘fieldName5’);
foreach ($arrayFieldNames as $fieldName) {
switch ( {$fieldName}) {
case "Y’ : $yesAnwers+=1;break;
case "N’ : $noAnswers+=1;break;
case “” : $emptyAnswers+=1;break;
}
}
// and here I would check the different combiantions of valid yes/no/empty answers