将数据从html文件中的文本区域传输到另一个php文件

时间:2016-11-08 15:52:28

标签: php html

我的问题是我想创建一个博客。我对编码很新,所以我不是很好。我的主要问题是将代码从html文件中的文本区域发送到PHP文件,我甚至不知道如何修复。

this is a image of the file where someone types their blog it is a html file.

this is the image of the storage place or where all the blogs will be put. It is a phpfile

blog.html文件的代码(你写的东西)

<!DOCTYPE html>
		<body>
		<h2 style="background-color:blue;color:white">
		TheBlog
		</h2>
	</head></font>
			<p> <center><h5 style="background-color:blue;color:white">
			This is where you can type the text!</p>
			</h5></center>	
			 <form action="Storage-Area-For-Blog.php" method="post"> 
			<textarea name="txtcomment" cols="160" rows="40"></textarea>
    <input type="submit" value="Publish">  
    <input type="reset" name="Clear">
    </form>
	<h5><ul>
			<li><a href="Blog-Homepage.html">Home</a></li>
			<li><a href="Blog-Creating-Process.html">Creation Process</a></li>
		</ul></h5>
		</body>-->
</html>	

存储区代码

<!DOCTYPE html>
	<body>
		<?php echo $_POST['txtcomment']; ?>
	</body>
</html>

1 个答案:

答案 0 :(得分:0)

file form.html

<!DOCTYPE html>
<html>

<body>
    <h2 style="background-color:blue;color:white">
        TheBlog
        </h2>

    <h5 style="background-color:blue;color:white; text-align: center">
                This is where you can type the text!</h5>

    <form name="test" action="process_form.php" method="post">
        <textarea name="txtcomment" id="txtcomment" cols="160" rows="40"></textarea>
        <br>
        <input type="submit" value="Publish">
        <input type="reset" name="clear">
    </form>
    <h5><ul>
            <li><a href="blog-homepage.html">Home</a></li>
            <li><a href="blog-breating-process.html">Creation Process</a></li>
        </ul></h5>
</body>
</html>

file process_form.php

<!DOCTYPE html>
<html>
    <body>
        <?php echo $_POST['txtcomment']; ?>
    </body>
</html>

这有效......