I have the HTML and PHP code as below. I have code one file html2word.php
:
<form method="post" action="htmltortf.php">
<table>
<tr>
<td colspan="3">Convert html to doc</td>
</tr>
<tr>
<td colspan="3">Choose the answer</td>
</tr>
<tr>
<td><input type="radio" name="004" value="1" <?=($_POST['004']=='1' ? 'checked="checked"' : '')?>/>1</td>
<td><input type="radio" name="004" value="2" <?=($_POST['004']=='2' ? 'checked="checked"' : '')?>/>2</td>
<td><input type="radio" name="004" value="3" <?=($_POST['004']=='3' ? 'checked="checked"' : '')?>/>3</td>
</tr>
<tr>
<td colspan="3"><input type="submit" name="submit" value="submit" /></td>
</tr>
</table>
<?php
if(isset($_POST['submit']))
{
header("Content-type: application/vnd.ms-word");
header("Content-Disposition: attachment;Filename=html2doc.doc");
}
?>
</form>
What I need:
When the user checked on radio box it is also display the radio box is checked when I convert it to MS-Word.
The problem:
When I converted it to word document, it will display the radio box that I checked but it shows me the error message:
Notice: Undefined index: 004 in C:\wamp\www\html to docv2\htmltortf.php on line 51
.
How do I fix this?