[英]Data entered in index.php cannot show on process.php
試圖遵循有關如何使用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>
這是表格的屏幕截圖。 點擊這里獲取index.php圖片
請問這是process.php里面的內容
<?php
print_r($_POST);
這是顯示process.php圖像的內容
對不起,這個新手。 希望你們能提供幫助。 謝謝!
也許您錯過了“行動”?
<form method="post" action="/process.php">
您應該指定所需的內容。
<?php
print_r($_POST['first_name']);
或使用foreach
循環獲取完整的數組值。
您可以填寫action
標記,因此在submit
表單時它將進入proccess.php
頁面。
<form method="post" action="process.php">
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.