-2
我有如下的HTML和PHP代码。我有一个代码文件html2word.php
:使用PHP将所有html文件中的值转换为MS-Word
<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>
我需要什么:
当用户在单选框选中它也显示,当我将其转换为MS-Word中的无线电框被选中。
问题:
当我将它转换为Word文档,它会显示我检查无线框,但它让我看到错误消息:
Notice: Undefined index: 004 in C:\wamp\www\html to docv2\htmltortf.php on line 51
。
我该如何解决这个问题?
非常感谢,但它显示错误消息'注意事项:用C 004:未定义指数: \ wamp \ www \ html到第75行的docv2 \ htmltortf.php。当我将它转换为word文档时,它可以工作。 – user1629258
此通知不是严重错误。这cozed我真的不检查'isset($ _ POST ['004'])''。如果你会告诉我你的75线,我会更确切地说你。 – StasGrin
这是第75行的代码' /> 1'。谢谢, – user1629258