Good day experts!
I am stuck on a problem. This is my function.php
function tbl_questions() {
global $mysqlhost, $mysqluser, $mysqlpwd, $mysqldb;
$connection=mysqli_connect($mysqlhost, $mysqluser, $mysqlpwd) or die ("Verbindungsversuch fehlgeschlagen");
mysqli_select_db($connection, $mysqldb) or die("Konnte die Datenbank nicht waehlen.");
$sql_tbl_questions = "SELECT * FROM `questions` where istAktiv='1'";
$quest_query = mysqli_query($connection, $sql_tbl_questions) or die("Anfrage nicht erfolgreich");
$i = 0;
while ($question = mysqli_fetch_array($quest_query)) {
$i++;
echo '<tr>';
echo '<th>'.$i.'</th>';
echo '<th>'.$question['question'].'</th>';
echo '<th class="text-center"><input type="radio" name="'.$question['dimension'].'_question_'.$question['id'].'" value="0" required></th>';
echo '<th class="text-center"><input type="radio" name="'.$question['dimension'].'_question_'.$question['id'].'" value="2.5"></th>';
echo '<th class="text-center"><input type="radio" name="'.$question['dimension'].'_question_'.$question['id'].'" value="5"></th>';
echo '<th class="text-center"><input type="radio" name="'.$question['dimension'].'_question_'.$question['id'].'" value="7.5"></th>';
echo '<th class="text-center"><input type="radio" name="'.$question['dimension'].'_question_'.$question['id'].'" value="10"></th>';
echo '</tr>';
$dimensions = $question['dimension'];
}
echo '<tr>';
echo '<th></th>';
echo '<th>Kommentar/Ihre Anmerkung</th>';
echo '<th class="text-center" colspan=5><textarea rows=3 cols=50 name="Kommentar"></textarea></th>';
echo '</tr>';
echo '<input type="hidden" name="gesamt" value="'.$i.'">';
echo '<input type="hidden" name="dimensions" value="'.$dimensions.'">';
echo '<input type="hidden" name="size" value="'.$_POST['size'].'">';
echo '<input type="hidden" name="branche" value="'.$_POST['branche'].'">';
//echo $_POST['size'];
//echo $_POST['branche'];
}`
That function.php is saving data from an questionaire which is containing values. My problem is as easy as complex. I am moving through this questionaire through an javascript:
function senden(goBack){
if(goBack==0)
{
document.getElementById('page').value++;
if( document.getElementById('page').value >9){
document.getElementById('submitForm').action='auswertung.php';
}
document.getElementById('submitForm').submit();
}
else
{
document.getElementById('page').value--;
if( document.getElementById('page').value <1){
document.getElementById('submitForm').action='branche.php';
}
document.getElementById('submitForm').submit();
}
}
And of course some html for the buttons:
<input type="hidden" id="page" name="page" value="<?php echo $page; ?>" />
<button type="button" id="doubleButtons" class="btn btn-default" onclick="senden(1)">Zurück</button>
<button type="button" id="doubleButtons" class="btn btn-default" onclick="senden(0)"><?php echo $page==9?"FDC Auswerten":"Weiter";?></button>
The questionnaire got those radio buttons which i am talking about, a button for next and a button for back.
My problem is : If i am filling my questionnaire and press the back button, the filled stuff is gone! So my idea was to save everything into an array, but can you give me a hint how i have to do it?
I hope my question is quite clear, if not, please excuse me and let me know!