Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pagination and storing into database

Tags:

php

mysql

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

like image 668
ukdub Avatar asked Jan 31 '26 22:01

ukdub


1 Answers

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.

like image 129
darwin Avatar answered Feb 03 '26 12:02

darwin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!