3
Hello guys I’m trying to think of a logica to make a question system with php but I’ve stopped in relation, when the user finishes asking question 1 it will give Submit to next then it would appear question number 2 and so on but my problem is that I am not able to think how to make it as soon as it der Ubmit it goes to question number 2 without being the same as before.
<?php
while($row = $result->fetch_assoc())
{
$db_questoes = $row['id_questao'];
if($db_questoes == 1 ){
echo nl2br($row['questao_biologia']);
}
}
?>
here is only the first but I can not think how to leave automatic, so it ends question 1 ,will appear question two.
Cara started to shed some light on this, as you would show the data in the questions.php?
– Robson Oliveira
Query the database based on the id of the new question and place the values in the right places. Type
Select * from questoes where id=$idPergunta
. Then put$row["campoRelevante"]
in the html paths that matter. To fetch the question the query string uses$idPergunta = $_GET["id"];
– Isac
I understood the paquina will be redirected with the new id ,but how to capture this id when it is updating? example questions.php? id=1 ai it updates to questions.php? id=2 and how can I cap this id 2 on the questions page.php
– Robson Oliveira
Thus
$idPergunta = $_GET["id"];
. With the PHP get array you can access the "parameters" of the url, called query string. I will detail a little the answer to this scenario.– Isac