我收到$ _POST變量未定義的索引錯誤。 I.E. $ _ POST [ '主機']。我知道有點爲什麼我得到他們,但有沒有辦法讓PHP和窗體保持在同一個文件中,而不是得到這些錯誤?使用後未定義索引
<html>
<head>
<title>Install Forum</title>
</head>
<body>
<h1>Please enter your database information</h1>
<form action='install.php' method='post'>
Hostname: <input type='text' name='hostname'><br/>
MySQL User: <input type='text' name='dbuser'><br/>
MySQL Pass: <input type='password' name='dbpassword'><br/>
<input type='submit' name='submit' value='Submit'><br/>
</body>
</html>
<?php
include_once("config.php");
$date = date('Y-m-d');
//Database Variables
$dbhost = strip_tags($_POST['hostname']);
$dbuser = strip_tags($_POST['dbuser']);
$dbpass = strip_tags($_POST['dbpassword']);
$submit = isset($_POST['submit']);
[PHP:「通知:未定義變量」和「通知:未定義指數」]的可能重複(http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index) – Jocelyn