-1

I am using this code but can't figure out what's wrong with it.

if (!empty($_POST)) {
    foreach ($_POST as $key => $value) {
        if (get_magic_quotes_gpc()) 
            $value=stripslashes($value);
        if ($key=='extras') {       
            if (is_array($_POST['extras'])) {
                print "<tr><td><code>$key</code></td><td>";
                foreach ($_POST['extras'] as $value) {
                print "<i>$value</i><br />";
                }
                print "</td></tr>";
                } 
            else {
                print "<tr><td><code>$key</code></td><td><i>$value</i></td></tr>\n";
                }
            } 
        else {
            print "<tr><td><code>$key</code></td><td><i>$value</i></td></tr>\n";
        }
    } // end foreach
}

It prints prgm 'array' in table instead of values inside array.

4

1 回答 1

2

I feel like using print_r() would be at least a way to gain some insight into the structure of the array.

于 2013-10-13T16:56:38.153 回答