Reputation: 153
Hi all I want to create question and answer with pagination, after clicking the next button first page should validate and store in database and will go to next page? i tried some code but i have no idea how to post the value and store into database with pagination.
my code is
<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>
}
and in pagination field i put
$linktext.=" <a href='$nextlnk' title='Show Next ".$this->MaxRecord." Data'><input type='Submit' name='button' value='Submit' ></a>";
How can i store the question value in database.
please help
Upvotes: 3
Views: 183
Reputation: 240
If you use PHP you can add the following after having updated your mysql database to redirect the user to the next page:
header("Location: $nextlnk");
Then all you need is a submit button that says "Next" that will both post the answer and push the user forward to the next question.
Upvotes: 1