HeaderContent-Disposition

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bigoxygen@gmail.com

    HeaderContent-Disposition

    Hi.

    I'm wondering if there is a way to limit a certain chunk of
    text to be put into the csv file (as shown below), like a way to
    end the header.

    The reason I ask is because I do get my csv files alright,
    but there is a whole chunk of html that gets put into the file as well.

    Thanks in advance

    function export(&$arrdat a,&$linkname='t est',&$filename ='test') {


    header('Content-Type: application/csv');
    header('Content-Disposition: attachment; filename=data.c sv');

    //echo $arrdata[0]["evaluatee"]["group_avg"][0];

    //echo $arrdata[0]["numOfMembe rs"];
    for($i=0;$i<$ar rdata[0]["numOfMembe rs"];$i++){

    echo $arrdata[0]['evaluatee'][$i]['last_name'] . "," .
    $arrdata[0]['evaluatee'][$i]['last_name'] . "," .
    $arrdata[0]['evaluatee'][$i]["average_gr ade"]. "\r";

    }

  • Andy Hassall

    #2
    Re: HeaderContent-Disposition

    On 24 Feb 2005 15:24:28 -0800, bigoxygen@gmail .com wrote:
    [color=blue]
    >I'm wondering if there is a way to limit a certain chunk of
    >text to be put into the csv file (as shown below), like a way to
    >end the header.
    >
    >The reason I ask is because I do get my csv files alright,
    >but there is a whole chunk of html that gets put into the file as well.[/color]

    It'd help if you said what the "chunk of html" was.
    [color=blue]
    >Thanks in advance
    >
    >function export(&$arrdat a,&$linkname='t est',&$filename ='test') {[/color]

    It's probably PHP notices from your declaration here; you cannot use default
    values for parameters declared as pass-by-reference unless you're using PHP5.


    [color=blue]
    >header('Conten t-Type: application/csv');
    >header('Conten t-Disposition: attachment; filename=data.c sv');
    >
    >//echo $arrdata[0]["evaluatee"]["group_avg"][0];
    >
    >//echo $arrdata[0]["numOfMembe rs"];
    >for($i=0;$i<$a rrdata[0]["numOfMembe rs"];$i++){
    >
    > echo $arrdata[0]['evaluatee'][$i]['last_name'] . "," .
    >$arrdata[0]['evaluatee'][$i]['last_name'] . "," .
    >$arrdata[0]['evaluatee'][$i]["average_gr ade"]. "\r";
    >
    >}[/color]

    --
    Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
    <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

    Comment

    Working...