次のようなエラーが発生します。注意:未定義の変数:4行目で送信します。送信ボタンで定義したので、理由がわかりません。誰かが理由を説明できますか?ここで問題を実際に見ないでください。
<?php
if($submit)
{
$sql = "INSERT INTO personnel (first, last, username, department, email) VALUES ('$first','$last','$username','$department','$email')";
$add = mysql_query($sql);
echo "<div class='confirmation-box round'>Thank you! New user have been added</div>";
}
else
{
?>
<form method="post" action="useradd.php">
<fieldset>
<p>
<label for="simple-input">Firstname</label>
<input type="text" id="first" name="firstname" class="round default-width-input" />
</p>
<p>
<label for="simple-input">Lastname</label>
<input type="text" id="last" name="lastname" class="round default-width-input" />
</p>
<p>
<label for="simple-input">Username</label>
<input type="text" id="username" name="username" class="round default-width-input" />
</p>
<p>
<label for="simple-input">Department</label>
<input type="text" id="department" name="department" class="round default-width-input" />
</p>
<p>
<label for="simple-input">Email</label>
<input type="text" id="email" name="email" class="round default-width-input" />
</p>
<input type="Submit" name="submit" class="button round blue image-right ic-add text-upper" value="Add">
</fieldset>
</form>
<?php
}
?>
(愚かな質問でごめんなさい、phpでちょっと新しいです)