0

My code kinda weird, i don't know what would be the problem of my code.. here's my code.

$project_name = $_POST['project_name'];//example the retrieved data is Testing Project
$quote_id = $_POST['quote_id'];//example the retrieved data is 34425
$date = date("M/d/y");
$as_agent = $_POST['as_agent'];//example the retrieved data is John Doe

$name_for_project = $project_name.' '.$quote_id.' '.$date.' '.$as_agent;


header("Content-Type: application/vnd.ms-excel");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("content-disposition: attachment;filename='".$name_for_project.".xls'");
ob_start();

//The rest of the code is Workbook
echo"
    <?xml version='1.0'?>
    <?mso-application progid='Excel.Sheet'?>
    <Workbook
xmlns='urn:schemas-microsoft-com:office:spreadsheet'
xmlns:o='urn:schemas-microsoft-com:office:office'
xmlns:x='urn:schemas-microsoft-com:office:excel'
xmlns:ss='urn:schemas-microsoft-com:office:spreadsheet'
xmlns:html='http://www.w3.org/TR/REC-html40'>
<DocumentProperties xmlns='urn:schemas-microsoft-com:office:office'>
    <Version>11.8036</Version>
</DocumentProperties>
<ExcelWorkbook xmlns='urn:schemas-microsoft-com:office:excel'>
    <WindowHeight>6795</WindowHeight>
    <WindowWidth>8460</WindowWidth>
    <WindowTopX>120</WindowTopX>
    <WindowTopY>15</WindowTopY>
    <ProtectStructure>False</ProtectStructure>
    <ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>";

    //so on and so fort...

When this code runs it only capture the $project_name value.. Please Help me... Thank you..

4

3 に答える 3

0

他の変数に、ファイル名として無効な文字が含まれていますか? たとえば、$date を 30/08/2013 として宣言した場合、php は無効な文字を超えて変数を連結しません。

于 2013-08-31T01:41:36.397 に答える