Foros del Web » Programando para Internet » PHP »

undefinded index

Estas en el tema de undefinded index en el foro de PHP en Foros del Web. Hola amigos: Necesito actulalizar datos en una tabla que viene de un formulario que es el que se ve mas abajo, estos datos son "si" ...
  #1 (permalink)  
Antiguo 22/05/2019, 10:17
 
Fecha de Ingreso: noviembre-2003
Mensajes: 499
Antigüedad: 20 años, 4 meses
Puntos: 7
undefinded index

Hola amigos:
Necesito actulalizar datos en una tabla que viene de un formulario que es el que se ve mas abajo, estos datos son "si" o "no", los tomo con "checkbox" (obvio que esto es un pedazo de codigo)
Código PHP:
<table  align="center"  class="mitabla">
    <form method="post" action="pagina3serv.php">
  <input type="hidden" name="Pre" value="<?php echo $Pre ?>"/>
<tr> 
<th>Rec. Porteria:</th>
<td><input name="receport" type="checkbox" value="<? echo $reg['receport']?><? if ($reg['receport']== "Si")echo'checked="true"'?>></td>
<th>Sala estar:</th>
<td><input name="salaestar" type="checkbox" value="<? echo $reg['salaestar']?><? if ($reg['salaestar']== "Si") echo'checked="true"'?>></td>
<th>Salon usos mult.:</th>
<td><input name="salonumul" type="checkbox" value="<? echo $reg['salonumul']?><? if ($reg['salonumul']== "Si") echo'checked="true"'?>></td>
</tr>

  <tr>
   <th>Salon Conv.:</th>
  <td><input name="salconve" type="checkbox" value="<? echo $reg['salconve']?><? if ($reg['salconve']== "Si") echo'checked="true"'?>></td>
<th>Cocheras Cub.:</th>
  <td><input name="cocheracu" type="checkbox" value="<? echo $reg['cocheracu']?><? if ($reg['cocheracu']== "Si") echo'checked="true"'?>></td>
<th>Serv. Lavand.:</th>
  <td><input name="servlavand" type="checkbox"  value="<? echo $reg['servlavand']?><? if ($reg['servlavand']== "Si") echo'checked="true"'?>></td>
</tr>

<tr>
  <th>Caja Seg.:</th>
  <td><input name="cajaseg" type="checkbox"  value="<? echo $reg['cajaseg']?><? if ($reg['cajaseg']== "Si") echo'checked="true"'?>></td>
   <th>Servicio Msg.:</th>
  <td><input name="servmensa" type="checkbox"  value="<? echo $reg['servmensa']?><? if ($reg['servmensa']== "Si") echo'checked="true"'?>></td>
<th>Serv. Bar:</th>
  <td><input name="servbar" type="checkbox"  value="<? echo $reg['servbar']?><? if ($reg['servbar']== "Si") echo'checked="true"'?>></td>
</tr>

  <tr>
<th>Desayunador:</th>
  <td><input name="desayunador" type="checkbox"  value="<? echo $reg['desayunador']?><? if ($reg['desayunador']== "Si") echo'checked="true"'?>></td>
   <th>Salon Comedor:</th>
  <td><input name="saloncomedor" type="checkbox"  value="<? echo $reg['saloncomedor']?><? if ($reg['saloncomedor']== "Si") echo'checked="true"'?>></td>
<th>Salon rec. Niños:</th>
  <td><input name="salonrecreoninos" type="checkbox"  value="<? echo $reg['salonrecreoninos']?><? if ($reg['salonrecreoninos']== "Si") echo'checked="true"'?>></td>
</tr>

  <tr>
<th>Pers. bilingue:</th>
  <td><input name="persbilingue" type="checkbox"  value="<? echo $reg['persbilingue']?><? if ($reg['persbilingue']== "Si") echo'checked="true"'?>></td>
   <th>Ascensor:</th>
  <td><input name="ascensor" type="checkbox"  value="<? echo $reg['ascensor']?><? if ($reg['ascensor']== "Si") echo'checked="true"'?>></td>
<th>Comod. Discap.:</th>
  <td><input name="comodiscap" type="checkbox"  value="<? echo $reg['comodiscap']?><? if ($reg['comodiscap']== "Si") echo'checked="true"'?>></td>
</tr>

  <tr>
<th>Serv. Habitacion:</th>
  <td><input name="servihabitac" type="checkbox"  value="<? echo $reg['servihabitac']?><? if ($reg['servihabitac']== "Si") echo'checked="true"'?>></td>
   <th>Serv. Niñera:</th>
  <td><input name="serninera" type="checkbox"  value="<? echo $reg['servninera']?><? if ($reg['servninera']== "Si") echo'checked="true"'?>></td>
<th>Serv.Medico</th>
  <td><input name="servmedico" type="checkbox"  value="<? echo $reg['servmedico']?><? if ($reg['servmedico']== "Si") echo'checked="true"'?>></td>
</tr>

<tr>
<th>Serv. Seguridad:</th>
  <td><input name="servseg" type="checkbox"  value="<? echo $reg['servseg']?><? if ($reg['servseg']== "Si") echo'checked="true"'?>></td>
   <th>Contingentes:</th>
  <td><input name="admiteconti" type="checkbox"  value="<? echo $reg['admiteconti']?><? if ($reg['admiteconti']== "Si") echo'checked="true"'?>></td>
<th>Mascotas:</th>
  <td><input name="admitemasco" type="checkbox"  value="<? echo $reg['admitemasco']?><? if ($reg['servmensa']== "Si") echo'checked="true"'?>></td>
</tr>

<tr>
<th>Baños Priv.:</th>
  <td><input name="banoprivado" type="checkbox"  value="<? echo $reg['banoprivado']?><? if ($reg['banoprivado']== "Si") echo'checked="true"'?>></td>
   <th>Baños Comunes:</th>
  <td><input name="banousocomun" type="checkbox"  value="<? echo $reg['banousocomun']?><? if ($reg['banousocomun']== "Si") echo'checked="true"'?>></td>
<th>Tv. Color:</th>
  <td><input name="tvcolor" type="checkbox"  value="<? echo $reg['tvcolor']?><? if ($reg['tvcolor']== "Si") echo'checked="true"'?>></td>
</tr>

<tr>
<th>Musica Func.:</th>
  <td><input name="musicafunc" type="checkbox"  value="<? echo $reg['musicafunc']?><? if ($reg['musicafunc']== "Si") echo'checked="true"'?>></td>
   <th>Telefono:</th>
  <td><input name="telefono" type="checkbox"  value="<? echo $reg['telefono']?><? if ($reg['telefono']== "Si") echo'checked="true"'?>></td>
<th>Calefaccion:</th>
  <td><input name="calefaccion" type="checkbox"  value="<? echo $reg['calefaccion']?><? if ($reg['calefaccion']== "Si") echo'checked="true"'?>></td>
</tr>

<tr>
<th>Aire Acc.</th>
  <td><input name="aireacondicionado" type="checkbox"  value="<? echo $reg['aireacondicionado']?><? if ($reg['aireacondicionado']== "Si") echo'checked="true"'?>></td>
   <th>Frigobar:</th>
  <td><input name="frigobarhelad" type="checkbox"  value="<? echo $reg['frigobarhelad']?><? if ($reg['frigobarhelad']== "Si") echo'checked="true"'?>></td></td>
<th>Kitchenette:</th>
  <td><input name="kitchenette" type="checkbox"  value="<? echo $reg['kitchenette']?><? if ($reg['kitchenette']== "Si") echo'checked="true"'?>></td></td>
</tr>

<tr>
<th>Parque Arbol.:</th>
  <td><input name="parquearbol" type="checkbox"  value="<? echo $reg['parquearbol']?><? if ($reg['parquearbol']== "Si") echo'checked="true"'?>></td></td> 
   <th>Juegos Inf.:</th>
  <td><input name="juegosinfant" type="checkbox"  value="<? echo $reg['servmensa']?><? if ($reg['servmensa']== "Si") echo'checked="true"'?>></td></td>
<th>Solarium:</th>
  <td><input name="solarium" type="checkbox"  value="<? echo $reg['solarium']?><? if ($reg['solarium']== "Si") echo'checked="true"'?>></td></td>
</tr>

<tr>
<th>Pileta Natac.:</th>
  <td><input name="piletanatac" type="checkbox"  value="<? echo $reg['piletanatac']?><? if ($reg['piletanatac']== "Si") echo'checked="true"'?>></td></td> 
   <th>Pileta Niños:</th>
  <td><input name="piletaninos" type="checkbox"  value="<? echo $reg['piletaninos']?><? if ($reg['piletaninos']== "Si") echo'checked="true"'?>></td></td>
<th>Pileta Climat.:</th>
  <td><input name="piletaclimat" type="checkbox"  value="<? echo $reg['piletaclimat']?><? if ($reg['piletaclimat']== "Si") echo'checked="true"'?>></td></td>
</tr>

<tr>
<th>Sauna:</th>
  <td><input name="sauna" type="checkbox"  value="<? echo $reg['sauna']?><? if ($reg['sauna']== "Si") echo'checked="true"'?>></td></td> 
   <th>Gimnasio:</th>
  <td><input name="gimnasio" type="checkbox"  value="<? echo $reg['gimnasio']?><? if ($reg['gimnasio']== "Si") echo'checked="true"'?>></td></td>
<th>Quincho:</th>
  <td><input name="quincho" type="checkbox"  value="<? echo $reg['quincho']?><? if ($reg['quincho']== "Si") echo'checked="true"'?>></td></td>
</tr>

<tr>
<th>Asador:</th>
  <td><input name="asador" type="checkbox"  value="<? echo $reg['asador']?><? if ($reg['asador']== "Si") echo'checked="true"'?>></td></td> 
   <th>Deportes:</th>
  <td><input name="deportes" type="checkbox"  value="<? echo $reg['deportes']?><? if ($reg['deportes']== "Si") echo'checked="true"'?>></td></td>
</tr>


  <td><input type="submit" value="Confirmar"></td>
</tr>  
  </table>
    </form>
y necesito cargarlos con el nuevo valos y me tira el sgte error, no se por que :Notice: Undefined index: deportes in, el script de grabacion es
Código PHP:
<?php
$v1 
$_POST['Pre'];
echo 
$v1;
echo 
$_POST['receport'];
$conexion=mysqli_connect("xxx","xxxx","xxxx","xxx") or
    die(
"Problemas con la conexión");

mysqli_query($conexion"UPDATE servicios SET receport = '$_REQUEST[receport]',"
  
"salaestar ='$_REQUEST[salaestar]', salonumul = '$_REQUEST[salonumul]',".
  
"salconve = '$_REQUEST[salconve]',cocheracu ='$_REQUEST[cocheracu]',".
  
"servlavand ='$_REQUEST[servlavand]',cajaseg ='$_REQUEST[cajaseg]',"
  
"servmensa = '$_REQUEST[servmensa]',servbar = '$_REQUEST[servbar]',".
  
"desayunador ='$_REQUEST[desayunador]',saloncomedor ='$_REQUEST[saloncomedor]',".
    
"salonrecreoninos = '$_REQUEST[salonrecreoninos]',persbilingue = '$_REQUEST[persbilingue]',".

  
"asador = '$_REQUEST[asador]',deportes = '$_REQUEST[deportes]'
                  WHERE nr = $v1"
)
                          or
  die(
"Problemas en el select:".mysqli_error($conexion));
  echo 
"El registro fue modificado con exito";
?>
algien que me tire una soga, gracias
  #2 (permalink)  
Antiguo 22/05/2019, 21:00
Avatar de ArturoGallegos
Moderador
 
Fecha de Ingreso: febrero-2008
Ubicación: Morelia, México
Mensajes: 6.774
Antigüedad: 16 años, 1 mes
Puntos: 1146
Respuesta: undefinded index

error 1

Código HTML:
Ver original
  1. <table  align="center"  class="mitabla">
  2.     <form method="post" action="pagina3serv.php">
  3.   <input type="hidden" name="Pre" value="<?php echo $Pre ?>"/>
  4. <tr>

error 2
$_REQUEST[deportes]
debe ser
$_REQUEST["deportes"] o $_REQUEST['deportes']


error 3
$_REQUEST

Deja de usar $_REQUEST esta desaconsejado y error de novato a mi juicio, utiliza GET o POST segun lo que aplique, pero $_REQUEST NO!
  #3 (permalink)  
Antiguo 23/05/2019, 09:15
 
Fecha de Ingreso: noviembre-2003
Mensajes: 499
Antigüedad: 20 años, 4 meses
Puntos: 7
Respuesta: undefinded index

gracias amigo, estuve mucho tiempo parado, muy valiosas sus ayudas, algunas cosas no me funcionan, pero agradezco su dedicacion

Etiquetas: index, mysql, query, select, tabla
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:49.