Si certamente..non ho copiato tutta la porzione di codice ma è definita.
Questa la porzione di codice completa per questa funzione:
codice:if(isset($_GET['n']) && isset($_GET['id']) && isset($_GET['action']) && $_GET['action'] == "edit"){ echo '<script>console.log("Edit inside");</script>'; $sql2 = "SELECT * FROM ".$_GET['n'].";"; $res2 = $db->prepare($sql2); $res2->execute(); $data2 = $res2->fetchAll(PDO::FETCH_ASSOC); $keys2 = array_keys($data2[0]); $first2 = null; $cp2t = 0; foreach ($keys2 as $k2) { if ($cpt2 == 0){ $first2 = $k2; $cpt2 += 1;} } $edition = 1; $sql = 'SELECT * FROM `'.$_GET["n"].'` WHERE '.$first2.'='.$_GET[$first2].';'; $res = $db->prepare($sql); $res->execute(); $data = $res->fetchAll(PDO::FETCH_ASSOC); $keys = array_keys($data[0]); echo '<form method="post" action="clash.php?n='.$_GET["n"].'"> <div class="row"> <table class="table table-striped table-bordered"> <tr>'; $first = null; $cpt = 0; foreach ($keys as $k) { if($cpt == 0){ $first = $k; $cpt += 1;} echo '<th>'.$k.'</th>'; } echo '</tr>'; $nb = 0; foreach ($data as $k => $v) { echo '<tr>'; foreach ($v as $key => $value) { if($nb == 0){$custom = "disabled"; $nb = 1; $firstval=$value;} else{$custom="";} echo '<td><input '.$custom.' type="text" name="'.$key.'" value="'.$value.'"></td>'; } echo '</tr>'; } echo '<input type="hidden" name="table" value="'.$_GET["n"].'">'; echo '<input type="hidden" name="first" value="'.$first.'">'; echo '<input type="hidden" name="firstval" value="'.$firstval.'">'; echo '</table></div><input type="submit" class="btn btn-primary"></form>'; }