You are trying to set a header() using methods not supported.  But the
really interesting bit is that you appear to be using it NOT for sending
HTTP headers, but for setting header information on a TABLE????

read http://php.net/header

...this isn't what it does.

<?
function header_row($values)
    {
    $output = "<TR>";
    foreach($values as $key => $value)
        {
        $output .= "<TH>";
        $output .= $value;
        $output .= "</TH>";
        }
    $output .= "</TR>";
    return $output;
    }

$myheaders = array("ID","Name","Maker's Code","Maker Name","Label
Name","Product Type");

echo header_row($myheaders);
?>

The above should (untested) echo the following HTML:

<TR><TH>ID</TH><TH>Name</TH><TH>Maker's Code</TH><TH>Maker
Name</TH><TH>Label Name</TH><TH>Product Type</TH></TR>

... which is what I think you're after... althoug it seems a little weird :)


Justin


    




on 03/09/02 6:20 PM, Jean-Christian Imbeault ([EMAIL PROTECTED])
wrote:

> I get the following warning which makes no sense to me.
> 
> Warning: header() expects parameter 1 to be string, array given in
> /www/htdocs/jc/administration/edit_products/show_products.php on line 96
> 
> It's true that I am passing at an array to the function, but what I
> don't understand is why the function expects a string?
> 
> How does any function know the type of an incoming var in PHP anyway?
> 
> How can I fix my code to get rid of this error (while keeping the var as
> an array)?My code looks like this:
> 
> header(array("ID","Name","Maker's Code","Maker Name","Label
> Name","Product Type"));
> 
> function header_row($aH) {
> echo "  <TR>";
> foreach ($aH as $h) {
> ?>
> <TH>
> <?php echo $h; ?>
> </TH>
> <?php
> }
> echo "  </TR>";
> }
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to