I have a large datatable form. I like to set the database variables dynamically in this case the form input value submitted is 99
$nbs = array();
foreach ($rows as $r) {
$dec1 = 'q' . $r["sort"] . 'z1';
$dec2 = '(int) $_POST["q' . $r["sort"] . 'z1"]';
$nbs[$dec1] = $dec2;
}
extract($nbs);
This creates the following:
$q1000z1 = (int) $_POST[q1000z1];
var_dump($q1000z1);
outputs: string(27) "(int) $_POST["q100000z1"]"
but if i write the code
$q1000z1 = (int) $_POST[q1000z1];
var_dump($q1000z1);
outputs: 99
I like to get the 99 but something is wrong in my extract method because it doesn't get referenced to the form input value? Any suggestions?