So my code, opens word file with the web information but for some reason the javascript code is not working, it is suppose to show the day and the top of the page.
<?php
header(“Content-type: application/vnd.ms-word”);
header(“Content-Disposition: attachment;Filename=document_name.doc”);
echo” <html>”;
echo” <head>”;
echo”<script language=JavaScript >”;
echo”function mdy(todaysdate) { “;
//calls the function mdy why to get our date
echo” var month = new Array(); “;
echo” month[0] = January; “;
echo” month[1] = February; “;
echo” month[2] = March;”;
echo” month[3] = April;”;
echo” month[4] = May; “;
echo” month[5] = June; “;
echo” month[6] = July; “;
echo” month[7] = August;”;
echo” month[8] = September; “;
echo” month[9] = October; “;
echo” month[10] = November;” ;
echo” month[11] = December;”;
echo” var d = new Date(); “;
echo” var n = month[d.getMonth()];”;
echo “return n+ +todaysdate.getDate()+, +todaysdate.getFullYear()
}” ;
echo” #MainWrapper {
margin: 0 auto 0 auto;
position:relative;
width: 1400px;
background: #FFFFFF;
text-align:justify;
} “;
echo”</script>” ;
echo” <title>Form1</title> “;
echo”<style>”;
echo” hr.hr1{ “;
echo”top: 500px; “;
echo” position: fixed;
} “;
echo”hr.hr2{ “;
echo” position: relative; ” ;
echo” top:820px;
} “;
echo”</style>”;
echo”</head>”;
echo”<body>”;
echo” <form style=margin-left:300px; > “;
echo”<br/> <br/><br/><br/>”;
echo” <script language=JavaScript>
sampleDate1=new Date()
document.write ( mdy(sampleDate1))
</script>”;
echo” <br> “;
echo” 600″;
echo”<br><br><br>”;
echo”TO: 240/Associate Chief of Security Programs <br> “;
echo” <br><br> ” ;
echo” FROM: ”; echo $_POST[From];
echo” <br><br>”;
echo” SUBJECT: Emergency Request for Badge for Foreign National “;
echo” <br><br><br> “;
echo”I am requesting the emergency processing of a badge request for “; echo $_POST[name1]; echo” from <br>”;
echo $_POST[Date1]; echo”to “; echo $
echo”purpose of this visit is “;echo $_POST[purpose]; echo” .<br> The reason the visit must happen at this time is “; echo $
echo”<br><br> I apologize for the lateness of this request. All of the appropriate documents for this individual have been <br> “;
echo” uploaded to IDMax and approved by the sponsor. “;
echo” <br><br> “;
echo” I look forward to your approval. “;
echo” <br>
<br><br> “;
echo $_POST[name2];
echo” <br><br>”;
echo” Concurrence:”;
echo” <br><br><br> <br>”;
echo” <hr width=390 align=left > “;
echo” <hr width=100 align=left:1px > “;
echo” Piers Sellers, Deputy Director for Sciences and Exploration Date “;
echo” <br><br>”;
echo” Approval: “;
echo” <br><br><br> <br> “;
echo” <hr width=390 align=left > “;
echo” <hr width = 100 align=left:1px > “;
echo” Robert Raimond, Associate Chief of Security Programs Date
<br> “;
echo” cc:<br> “;
echo” 240/International Visits Coordinator/D.Brasel
“;
echo” </form> “;
echo” </body> “;
echo” </html>”; ?>