[英]$_POST is not returning anything
我是使用PHP的新手-我正在嘗試使用$ _POST從發送到Apache服務器的數據中獲取數據-但我什么都沒得到,下面是詳細信息
我在Windows 7上使用XAMPP進行設置(Apache和PHP)
而且我有兩個文件welcome.html,它正在調用welcome.php以回顯從html獲得的內容
請注意,Apache錯誤日志文件C:\\ xampp \\ apache \\ logs \\ error.log中沒有任何報告。
不知道這里出了什么問題
<head>
<meta charset="utf-8"/>
</head>
<body>
<form action="welcome.php" method="post">
Name: <input type="text" name="name"><br>
<input type="submit">
</form>
</body>
和welcome.php
<?php
error_reporting(E_ALL);
?>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
</head>
<body>
Welcome
<?php echo $_POST["name"]; ?><br>
</body>
用於測試您的php文件。 直接從本地主機運行此welcome.php,例如http://localhost/welcome.php
<?php
echo 'Check your name';
?>
如果看到“檢查您的姓名”; 然后您的本地服務器正在工作。 否則需要運行本地服務器
這是您的html welcome.html文件
<head>
<meta charset="utf-8"/>
</head>
<body>
<form action="welcome.php" method="post">
Name: <input type="text" name="name"><br>
<input type="submit">
</form>
然后使用名稱文字提交表單
然后使用檢查您的代碼
<?php
error_reporting(E_ALL);
print_r($_POST);
?>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
</head>
歡迎
一切都在這里工作
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.