I hate to sound like an idiot, but do i add that to the code i already have?
Like this?
<?php
require ('includes/application_top.php');
if (!$HTTP_GET_VARS['submit']) { ?>
<?php
echo "Export and Save Board Questions onto your Local Machine";
echo '<form action="'. $phpself.'">';
echo '<input type="submit" value="Export" name="submit"></form>';
?>
<?php
}
else
{
$contents="HR Category,Posting,Statement\n";
$user_query = mysql_query('select
f.faqdesk_id
, c.categories_id
, f.faqdesk_question
, c.categories_name
, f.faqdesk_answer_short
from faqdesk_description as f
join faqdesk_to_categories as f2c
on f.faqdesk_id = f2c.faqdesk_id
join faqdesk_categories_description as c
on f2c.categories_id = c.categories_id');
Header("Content-Disposition: attachment; filename=export.csv");
while($row = mysql_fetch_array($user_query))
{
$catname = escapeCommaStripHtml($row['categories_name']);
$faqquest = escapeCommaStripHtml($row['faqdesk_question']);
$faqanswer = escapeCommaStripHtml($row['faqdesk_answer_short']);
echo "$catname,$faqquest,$faqanswer\n";
}
function escapeCommaStripHtml($string)
{
return preg_replace('/<[>]+>/', '', str_replace(',', '\,', $string));
}
}
?>
I've been playing with it and testing it in so many ways that I'm getting cross-eyed.
when I apply it I get an error inside the excel sheet. Here is the link: www.mastertheboard.com/board_topic_export2.php where I am trying to make it work. It's part of an Oscommerce cart.
Before I had it working at this domain: www.mastertheboard.com/board_topic_export.php
Except that there is still the html and comma problems.
I have no idea what I'm doing wrong.