这是我在这个网站上的第一篇文章和问题。我现在正在做我的学校作业,我必须检查登录凭据是否与关联数组中列出的凭据相同。我到处搜索,但找不到答案。有人可以告诉我该怎么做吗?
这是我的 PHP 代码:
// Create associative array
$loginCombinations = array("Lucas"=>"lucas3284", "Bob"=>"bob9584", "Frits"=>"frits1842", "Kees"=>"kees1394", "Sjakie"=>"sjakie1953", "Bas"=>"bas6382", "Peter"=>"peter2391", "Robbie"=>"robbie1289", "Jan"=>"jan1462", "Tim"=>"tim9324");
// Create message (login succesful / login failed)
$message = "";
// Create foreach loop
foreach($loginCombinations as $username => $password)
{
}
这是我的 HTML 代码:
<form action="login.php" method="get">
<table>
<tr>
<td>
</td>
<td>
<?php
echo $message;
?>
</td>
</tr>
<tr>
<td>
<label for="username">username</label>
</td>
<td>
<input type="text" id="username" name="username">
</td>
</tr>
<tr>
<td>
<label for="password">password</label>
</td>
<td>
<input type="password" id="password" name="password">
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="submit">
</td>
</tr>
</table>
</form>
RISEBY
扬帆大鱼