Php 我的调查问卷的最后一页,是否将“下一步”按钮替换为“提交”按钮?
我想让我的测验最后一页的末尾有一个提交按钮。现在,如果测验是空的、完成的或没有问题,则会出现前进和后退按钮Php 我的调查问卷的最后一页,是否将“下一步”按钮替换为“提交”按钮?,php,jquery,html,forms,form-submit,Php,Jquery,Html,Forms,Form Submit,我想让我的测验最后一页的末尾有一个提交按钮。现在,如果测验是空的、完成的或没有问题,则会出现前进和后退按钮 当数据库中四个答案的一组没有显示时(由于是空字符串),我如何使其显示为“提交”按钮并替换“下一步”按钮 我的SQL表由qid(int)、应答(varchar)、点(int)组成 代码(PHP/HTML) <html> <head> <meta charset="utf-8"> <script> func
当数据库中四个答案的一组没有显示时(由于是空字符串),我如何使其显示为“提交”按钮并替换“下一步”按钮 我的SQL表由qid(int)、应答(varchar)、点(int)组成 代码(PHP/HTML)
<html>
<head>
<meta charset="utf-8">
<script>
function goBack() {
window.history.go(-1);
}
</script>
</head>
<body>
<?php
$localhost = "localhost";
$username = "root";
$password = "";
$connect = mysqli_connect($localhost, $username, $password) or die ("Kunde inte koppla");
mysqli_select_db($connect, 'wildfire');
$qid = 1;
if(count($_POST) > 0){
$qid = intval($_POST['qid'])+1;
}
?>
<form method="post" action="">
<input type="hidden" name="qid" value="<?=$qid?>">
<?php
$sql1 = mysqli_query($connect,"SELECT * FROM question where answer != '' && qid =".intval($qid));
while($row1=mysqli_fetch_assoc($sql1)){
?>
<input type='radio' name='answer1' value="<?php echo $row1['Point'];?>"><?php echo $row1['answer'];?><br>
<?php
}
?>
<button type="button" onclick="history.back();">Tillbaka</button>
<input type='submit' name='forward' value='Nästa'>
</form>
</body>
</html>
函数goBack(){
window.history.go(-1);
}
蒂尔巴卡
“当数据库中的一组四个答案没有显示时(由于为空字符串)”,此时您可以显示提交按钮。@Zapp!我只是不知道怎么做。我应该使用javascript吗?与数据库的连接将位于另一个文件中。您可以使用ajax调用sql,该文件将检测“数据库中的四个答案组没有显示(由于为空字符串)”,然后返回一个提交按钮。