PHP Code:
foreach($_POST AS $key => $value) {
${$key} = $value;
}
did not work. Output: "Extra masking is not required."
whole code:
PHP Code:
include 'xxx.php';
$a = 0 ;
// while (list ($key,$val) = @each ($_POST['box'])) {
// $$key = $val;
// $a = $a + 1 ;
// }
foreach($_POST AS $key => $value) {
${$key} = $value;
$a = $a + 1 ;
}
for ($j = 0; $j <= $a-1; $j++) {
for ($i = 0; $i <= $a-1; $i++) {
$box1 = $box["$i"] ;
$box2 = $box["$j"] ;
$queryziptrack2 = mysql_query("SELECT {$box1} FROM paint WHERE color='$box2'");
$querzipytrack1 = mysql_fetch_array($queryziptrack2);
if (mysql_num_rows($queryziptrack2) == 0) {
echo "No rows found, nothing to print so am exiting";
exit;
}
if ($querzipytrack1["{$box1}"] == 1) {
$masking = "<font color=red>Extra masking is required.</font>" ;
} else {
$masking1 = "<font color=red>Extra masking is not required.</font>" ;
}
}
}
echo "<form method=post action=''>";
echo "<table border='0' cellspacing='0' style='border-collapse: collapse' width='200' >
<tr bgcolor='#ffffff'>
<td width='25%'><input type=checkbox name=box[] value='black' /></td>
<td width='25%'> Black</td>
.....................................
<tr><td colspan =6 align=center><input type=submit value='Tell Me'></form></td></tr>
</table>";
below worked when register_globals = on
PHP Code:
foreach($_POST['box'] AS $key => $value) {
${$key} = $value;
$a = $a + 1 ;
}
Bookmarks