Translate

Wednesday, 17 April 2013

Convert PHP/HTML Form Coding to MS-Word & Excel

HTML/PHP Form to MS-Word:


header("Content-type: application/vnd.ms-word");
header("Content-Disposition: attachment; Filename=saveasword.doc");

      
HTML/PHP Form to MS-Excel:


header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; Filename=saveasexcel.xsl");

form.php: 
<body>
<form name="form" action="12.php" method="get">
<table border="1" width="300" cellpadding="10" cellspacing="0" align="center" id="tbl">
<tr>
    <td colspan="2" align="center">Application form</td>
    </tr>
<tr>
     <td>Name</td>
     <td>
     <input type="text" name="name" />
     </td>
</tr>
<tr>
     <td>Father name</td>
     <td><input type="text" name="fname" />
     </td></tr>
<tr>
     <td>Occuption</td>
     <td><input type="text" name="occupation"/>
     </td></tr>
<tr>
     <td>Gender</td>
     <td><input name="gender" type="radio" value="male" checked="checked" />Male<input name="gender" type="radio" value="Female"/>Female</td>
     </tr>
<tr> 
     <td colspan="3" align="center"><input name="submit" type="submit" value="Save as word"/></td>
     </tr>
     <tr>
     
     <td colspan="3" align="center"><input type="submit" name="submit1" value="Save as excel"/></td>
     
     </tr>     
</table>
</form>
</body>
</html>

12.php: 


           
         
  
                        

1 comment:

  1. It seems incomplete, could you elaborate in detail

    ReplyDelete