I want to fill data in the table. I get the values from Sessions and the POST.
There is the method where I am getting the values I want to put in the table.
if ( isset($_POST) ) {
//$valuee[] = array();
foreach ( $_POST as $key => $value )
//$valuee[] = str_split($value, 3);
var_dump($value);
//extract($valuee);
{
$cr = explode( "&",$key ); // ◄■■ SPLIT : [0]="CORP_RESP",[1]="1".
}
mysqli_query( $con,"insert into respostas
(menuid,corp_resp,id,data,
id_avaliacao) " .
"values ('{$cr[1]}','$value', '{$cr[2]}',
'{$cr[5]}', '{$cr[3]}')" );
}
That is the output I want to put in the table from var_dump($value)
.
string(4) "0.00" string(4) "0.00" string(4) "0.45" string(4) "0.00" string(4) "0.00" string(4) "0.50" string(4) "0.65" string(4) "0.75" string(4) "0.00" string(4) "0.00" string(4) "0.00" string(4) "0.60" string(4) "0.65" string(4) "0.00" string(4) "0.00" string(4) "0.60"
There is code where is building the table. That table is dynamic according what is select before the POST. The code need to handle with the number of columns and lines.
$s2 = $_SESSION['categorias'];
$utilizador = $_SESSION['utilizador'];
$uCount = $_SESSION['cparametro'];
$carCount = $_SESSION['ncategoria'];
$table ="<center><table><tr><center><td>Parametro</td></center>";
for($x = 0; $x < $carCount; $x++){
$val= htmlspecialchars($s2[$x], ENT_HTML5 | ENT_COMPAT, 'UTF-8');
$table= $table."<td>".$val."</td>";
}
$table = $table."</tr>";
for($i = 0 ; $i <$uCount ; $i++ ){
$table = $table."<tr><td>".$utilizador[$i]."</td>";
for($j=0;$j<$carCount;$j++){
$val= htmlspecialchars($s2[$j], ENT_HTML5 | ENT_COMPAT, 'UTF-8');
$table = $table."<td>";
$table = $table.$value;
$table = $table."</td>";
}
}
$table = $table."</tr>";
$teste = "Resultado";
$table= $table."<center><td>$teste</td></center>";
$table = $table."</table>";
echo $table;
Where is $table = $table.$value;
need to pass the values correct all is before in the fills and not passing only the last one? The rest of the table is correct.
Like you see in the picture what is the output:
Before the POST:
After the POST:
New output: