3
大家好我想创建问题和答案与分页,点击下一个按钮后,第一页应该验证和存储在数据库中,将进入下一页?我试过一些代码,但我不知道如何发布价值和存储到数据库与分页。分页和存储到数据库
我的代码是
<form class="cmxform" id="form1" method="get" action="process.php" >
$newsquestion=$db->paging("SELECT * FROM question where classname='$_SESSION[class_name]' and category in (select category from cat where class_name='$_SESSION[class_name]' order by p_order) and status='1'",1);
foreach($newquestion as question)
{
$answer=$db->get_results("SELECT * FROM answer where qid='$question->id'");
foreach($newanswer as $answer)
{
<input type="radio" name='answer_value1[<?php echo $question->id?>]' value="<?php echo$answer->id?>" validate="required:true" />
}
Comment :<textarea rows="5" cols="50" name="comment[<?php echo $question->id?>]" validate="required:true'" ></textarea>
}
和分页领域,我把
$linktext.=" <a href='$nextlnk' title='Show Next ".$this->MaxRecord." Data'><input type='Submit' name='button' value='Submit' ></a>";
我怎么能存储在数据库中的问题值。
请帮助
我试过了,但它不会显示下一个问题,它仍然显示相同的第一个问题,我把这个链接添加到“process.php”后,将问题和答案添加到数据库。我的代码是这样的:header(“Location:srv_form.php?$ nextlnk”); – ukdub
你确定你在'srv_form.php'script中有一些东西来捕捉你的'$ nextlnk'变量?你应该这样做:'header(“Location:srv_form.php?next = $ nextlnk”);'然后像下面这样捕获'next'变量:'if isset($ _ GET ['next'])'启动下一个问题根据存储在该索引中的值... – darwin
这个$ nextlnk变量是从另一个文件中获得的,我尝试在srv_form.php中打印,但它不会显示变量值。我在另一个PHP文件和函数中的代码存储就像这个函数getnewLink($ linkfor = 0){$ nextlnk = $ oldPage。“&cp =”。$ NextPage;}我调用srv_form.php中的链接函数是“echo $ db - > getnewLink(); \t \t“但我试图调用$ nextlink变量值到srv_form.php中,我不能。请指导我。 – ukdub