Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何通过php将表单输入放入html文件?_Html - Fatal编程技术网

如何通过php将表单输入放入html文件?

如何通过php将表单输入放入html文件?,html,Html,我有这个html文件: <div> <div class="input"> <img src="2017-01-10.jpg"> </div> <div class="input"> Some text here </div> <div class="input"> January 10th 2017 </div&

我有这个html文件:

<div>
    <div class="input">
        <img src="2017-01-10.jpg">
    </div>
    <div class="input">
        Some text here
    </div>
    <div class="input">
       January 10th 2017
    </div>
</div>

这里有一些文字
2017年1月10日
我想制作一个输入表单(在另一个页面中),在上面添加一个这样的div

因此,用户可以使用图像、文本和日期以及提交时间来填充表单,这些信息将添加到html文件中,上面是这样的代码,但需要新的输入

最后,代码是这样的:

<div>
    <div class="input">
        <img src="2017-01-11.jpg">
    </div>
    <div class="input">
        Some text here
    </div>
    <div class="input">
       January 11th 2017
    </div>
</div>

<div>
    <div class="input">
        <img src="2017-01-10.jpg">
    </div>
    <div class="input">
        Some text here
    </div>
    <div class="input">
       January 10th 2017
    </div>
</div>

这里有一些文字
2017年1月11日
这里有一些文字
2017年1月10日

我应该在表单的php文件中输入什么?
php是否可以永久写入html文件?

您需要处理SQL数据库的用户输入。然后,用户输入将永久存储在.html文件中。但您还没有完成,您还必须向站点添加一个
.htaccess
文件,以便将PHP解析为HTML

要了解如何将用户输入从PHP保存到SQL数据库,请观看以下内容。
要学习如何使用
.htaccess
请观看此演示。

您可以在数据库中插入表单数据,并在html页面中调用它,而while循环始终是第一个开始“我将在表单的php文件中放入什么?”-您需要从介绍性php教程开始,而不是从Stackoverflow开始。(好吧,你可以从它开始并使用它来找到一个合适的教程)。“php是否可以永久地写入html文件?”-可能,但这是一个糟糕的想法。使用数据库。谢谢你的回答!我将尝试学习一些php和Mysql