【发布时间】:2016-12-20 18:15:14
【问题描述】:
正在尝试遵循有关如何使用 html 将数据提交到 mysql 数据库的在线教程。
我创建了 2 个名为 index.php 和 process.php 的 php 文件。我想展示的是当我点击“添加员工”按钮时,我在 index.php 中输入的内容将显示在 process.php 上。但是什么都没有出现。
这是 index.php 里面的内容
<!DOCTYPE html>
<html>
<head>
<style>
label{display:inline-block;width:100px;margin-bottom:10px;}
</style>
<title>Add Employee</title>
</head>
<body>
<form method="post" action="">
<label>First Name</label>
<input type="text" name="first_name" />
<br />
<label>Last Name</label>
<input type="text" name="last_name" />
<br />
<label>Department</label>
<input type="text" name="department" />
<br />
<label>Email</label>
<input type="text" name="email" />
<br />
<input type="submit" value="Add Employee">
</form>
</body>
</html>
这是表单的屏幕截图。 click here for index.php image
这里是process.php里面的内容
<?php
print_r($_POST);
这就是显示的内容 process.php image
对不起初学者。希望大家能帮忙。谢谢!
【问题讨论】:
-
首先为要显示输出的页面指定表单操作属性
-
你的错误纠正了吗@Jas Soloria。
标签: php html mysql database xampp