Good evening I know they did not miss me, but I'm still stuck like a truck in the sand.
Accomplishments this week: I've already 'awakened' and I can pass not only one but my three variables. I already prepared all the 'pretty' query as Cedano likes, then I hang it up. But I still have a little problem. COMBOBOX does not work does not send the idgr that I choose (see) I used the same one I use in forms to complete data and that works great for INSERT, here it does not work for UPDATE magic, sorcery , simple ignorance of mine? Go code
<?php
session_start();
ob_start();
// Include config file
require_once '990conn.php';
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Documento sin título</title>
<link href="css/sbg.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php
require_once '990conn.php';
$idusr=$_GET['idusr'];
$nomb=$_GET['nomb'];
$grup=$_GET['grup'];
echo "<p>Nº usuar: <strong>$idusr</strong>";
echo "<p>Nombre : <strong>$nomb</strong>";
echo "<p>Grupo act: <strong>$grup</strong>";
?>
<table width="280" border="0" cellspacing="0" cellpadding="0"><tbody>
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post" target="_self" class="row" title="f098">
<!-- Selecciono el grupo dinamicamente de la tabla $t98g = 98gr que solo contiene dos columnas idgr (numérica) y gr (nombre del grupo) ver foto-->
<tr><td>
<select name="gru" size="12" required id="gru" form="f098" title="gru" >
<option value=""></option>
<?php $sql098b="select idgr, gr from $t98g";
$r098b=mysqli_query($mysqli, $sql098b);
while($rw098b=mysqli_fetch_array($r098b))
{
?>
<option value="<?php echo $rw098b['idgr']; ?>"><?php echo $rw098b['gr']; ?></option>
<?php
$gru=$rw098b['idgr'];
}
?>
</select></td></tr>
<tr><input name="bt-098" type="submit" class="btn-primary" id="bt-098" value="CAMBIAR GRUPO" /> </tr>
<tr><input name="idusr" value="<?php echo $idusr; ?>"></tr><!--EL idusr sigue firme-->
<!--<tr><input value="<?php //echo $gru; ?>"/></tr><!--AQUI ESTA MAL, toma por defecto el último de la lista 8=licencia-->
</form></tbody></table>
<?php
if($_SERVER["REQUEST_METHOD"] == "POST"){
if(isset($_POST['bt-098']))
{
$sql098 = "UPDATE 98usr SET 98grupo=$gru WHERE 98idusr=$idusr";
if(mysqli_query($mysqli, $sql098)){
echo "El grupo fue cambiado."; // me dice siempre que fue cambiado
} else{
echo "ERROR: No es posible ejecutar $sql098. " . $mysqli->error;
}
}
}
// Close connection
mysqli_close($mysqli);
?>
</body>
</html>