【发布时间】:2018-08-01 09:11:45
【问题描述】:
我正在为我的项目开发令牌重定向系统。 这就是我想要做的: 用户插入令牌 => 网站使用此令牌搜索条目,当他找到它时,他使用测试名称 => 重定向到测试页面。
但是我有一个问题,当我按下按钮时我没有任何反应。
这是我的代码:
if (isset($_POST['redibtn'])) {redit();}
function redit(){ if (isset($_POST['redibtn'])) {
global $db, $token, $errors;
// grap form values
$token = e($_POST['token']);
// attempt login if no errors on form
if (count($errors) == 0) {
$query = "SELECT * FROM tokens WHERE Token='$token' LIMIT 1";
$results = mysqli_query($db, $query);
if (mysqli_num_rows($results) == 1) { // user found
// check if user is admin or user
$choix = mysqli_fetch_assoc($results);
if ($choix['test'] == 'Integration') {
header('location: integrationffg/test.php');
}else{
header('location: aaa.php');
}
}else {
}
}
}
}
<form >
<center>
<p>Passer un exam :</p>
</center>
<div class="input-group">
<span class="input-group-addon" id="basic-addon1">Token</span>
<input required type="text" name="token" class="form-control" placeholder="Ex. b2f56acc7c212ee5af432e9794ccdbef" >
</div>
<br>
<center>
<button type="button" class="btn btn-primary" name="redibtn">Zuu</button>
</center>
</form>
我的数据库表:
有人可以帮帮我吗?
提前致谢。
【问题讨论】:
-
按钮式按钮不发送表单,需要按钮式提交)))
<button type="submit" class="btn btn-primary" name="redibtn">Zuu</button> -
提交表单时使用的默认方法是get。将
method="post"添加到<form>属性中应该可以了。 -
@Heyne 没用,虽然他没有提交按钮
-
整件事都不行。
-
... 并首先打开它。看?同样的事情。