通过PHP形式(HTML)到MySQL数据库

时间:2015-07-19 18:15:47

标签: php html mysql

这是我的HTML表单代码。

<html>
<form action="send_post.php" method="post">
<h3>Category:</h3>
<input type="text" name="post_category">
<h3>Post title:</h3>
<input type="text" name="post_title">
<h3>Post tags (a,b,c...):</h3>
<input type="text" name="post_tags">
<h3>Post (half):</h3>
<input type="text" name="post_half">
<h3>Post (score):</h3>
<input type="text" name="post_score">
<input type="submit">
</form>
</html>

我设置了数据库,但如何将这些内容连接到数据库?

因此,当您单击“提交”时,数据将转到数据库。

1 个答案:

答案 0 :(得分:2)

提交表单后,数据将使用HTTP POST方法发送到send_post.php文件。您可以在全局变量$ _POST中找到提交的表单数据。

本指南将帮助您了解如何在数据库中保存数据:http://www.w3schools.com/php/php_mysql_insert.asp