I am a complete PHP newbie but am falling quickly in love with this scripting language. I am using PHP right now to view information from a database and one thing I would like to do is allow people to download information in a .csv file.
I am using the header() function for authentication and would also like to use it to enable the file download. The problem of course is that I get a parsing error indicating that a header is already set. I have tried separating the two and simply calling them using include() but this doesn't work. how can I do both
header( 'WWW-Authenticate: Basic realm="Private"' );
header( 'HTTP/1.0 401 Unauthorized' );
and
header("Content-Disposition:$attachment filename=data.csv");
header("Content-type: text/plain");
????
thanks for the help. I sure its something simple so thanks for not flaming me. 😉