So i get this error :
Notice: Uninitialized string offset
I want to insert the value of the checked radio button of the radio button set at each row of my table .
That mean at every row of my table i have this Question ll Radio button set ll Commentary .
A survey form .
<?php
$link=Mysqli_connect($host,$login,$pass,$dbname);
$un = 0;
$msgerror = "Veuillez remplir tous les champs ";
if(isset($_POST["bouton10"])) {
$id = $_REQUEST["Picolo4"];
$Nom = $_REQUEST["Picolo1"];
$Prenom = $_REQUEST["Picolo2"];
$Email = $_REQUEST["Picolo3"];
if ($id !="" && $Nom !="" && $Prenom !="" && $Email !="") {
$recherche= "SELECT Ref,Question,Choix,Commentara FROM questionnaire WHERE Qref ='$id'";
mysqli_query($link,$recherche);
$result= mysqli_query($link,$recherche);
$num_results = $result->num_rows;
while ($row = mysqli_fetch_assoc($result)) {
$Ref =$row["Ref"];
$Question =$row["Question"];
$un++;
echo" <tr bgcolor=\"white\">
<td>$Question position: $un </td>
<td>
<input type=\"radio\" name =\"$un\" id =\"un\" value = \"3\">
<input type=\"radio\" name =\"$un\" id =\"un\" value = \"2\">
<input type=\"radio\" name =\"$un\" id =\"un\" value = \"1\">
<input type=\"radio\" name =\"$un\" id =\"un\" value = \"0\">
<input type=\"radio\" name =\"$un\" id =\"un\" value = \"0\">
</td>
<td width = \"60\"> <textarea> </textarea> </td>
</tr>
</div>
</div>";
}
} else {
echo "<script type='text/javascript'>alert('$msgerror')</script>";
}
}
//The part with the problem //
$un = 1;
if (isset($_POST["bouton11"])) {
$i= 0 ;
while(isset($_POST[$un])) {
//Line 71 //
$choix = $_POST["$un"][$i];
$enregistrer = "INSERT INTO questionnaire(Choix) VALUES('$choix') ";
$un++;
$i++;
mysqli_query($link, $enregistrer);
}
}
?>