I want to open a pop up window with a form that contains inputs when I click a button. I don't have problem to do that, the particularity is I want as much inputs (in the form of the pop up) as cells of a row from my orginal window.
Basically I have page1.php
that output SQL SELECT
queries. For each line I generate a button that opens a pop-up window on onClick()
event.
I want to use this button to give users possibility to modify a line.
I generate my table this way :
$result = Db::query($requete);
$texte = "<table class='table table-bordered table-sm'><thead>$table_header</thead>";
$texte .= "<tbody>";
if (!pg_num_rows($result)){
$nb_ligne = "Aucune ligne trouvée !";
}else{
$nb_ligne ="Nombre de lignes : ".pg_num_rows($result);
}
while($row = pg_fetch_row($result)){
$texte .= "<tr><td><button class=\"btn btn-primary\" type=\"button\" id=\"buttonCreate\" onclick=\"OuvrirPopup('update.php','', 'resizable=no, location=no, width=800, height=1000, menubar=no,status=no, scrollbars=no')\"></button></td>";
foreach ($row as $value){
$texte .= "<td style='word-break: keep-all'>$value</td>";
}
$texte .= "</tr>";
}
$texte .= "</tbody></table>";
$response = new Response();
$response->assign('nb_ligne', 'innerHTML', $nb_ligne);
$response->assign('tableau_resultat', 'innerHTML', $texte);
return $response;
I don't see how to generate as much inputs
as cells in a row
and also
how to set inputs
default value with what is already filled with.
I want to learn from this, so, if possible, explain to me what I'm doing wrong here, or if my approach is lacking insight.