我尝试过创建Cookie,但我的价值没有保存。这是我的代码。我已经尝试检查我的连接细节,但它看起来没问题。请帮忙,因为我找不到解决这个问题的方法。
<form method="POST">
<hr>
<div class="accounttype">
<input type="radio" value="Teacher" id="radioOne" name="account" checked/>
<label for="radioOne" class="radio" chec><span style="font-size: 23px;">Teacher</span></label>
<input type="radio" value="Student" id="radioTwo" name="account" />
<label for="radioTwo" class="radio"><span style="font-size: 23px;">Student</span></label>
</div>
<hr>
<label id="icon" for="name"><i class="icon-envelope "></i></label>
<input type="text" name="logid" id="logid" placeholder="Email" required/>
<label id="icon" for="name"><i class="icon-user"></i></label>
<input type="text" name="logName" id="logName" placeholder="Name" required/>
<label id="icon" for="name"><i class="icon-shield"></i></label>
<input type="password" name="logPassword" id="logPassword" placeholder="Password" required/>
<center><table>
<tr>
<td><center>
<input type="submit" name="Login" id="Login" value="Login" style="background-color: #3a57af; color: #ffffff; width: 105px; height: 40px;-webkit-border-radius: 20px;-moz-border-radius: 20px;border-radius: 20px;border: 0px;">
</center>
</td>
<?php
$userId = $_POST['logid'];
//$userName = $_POST['logName'];
$password = $_POST['logPassword'];
$account = $_POST['account'];
$teacher = "Teacher";
$student = "Student";
if ($account == $teacher) {
# code...
$sql = "SELECT * FROM teacherRecord WHERE email = '$userId' AND password='$password'";
$result = mysqli_query($con,$sql);
$check = mysqli_fetch_array($result);
if(isset($check)){
setcookie("email", $userId, time() + (86400 * 30), "/");
echo $_COOKIE['email'];
//echo "<script>window.location='profile.php'</script>";
}
}
&GT;