Foros del Web » Programando para Internet » PHP »

[SOLUCIONADO] PHP OO traer datos a un input con espacios

Estas en el tema de traer datos a un input con espacios en el foro de PHP en Foros del Web. ESTE ES M ICODIGO.. LO QUE PASA ES Q SI JALA MI BASE DE DATOS A LOS INPUT PERO SOLO JALA HASTA ANTES DEU NESPACIO.. ...
  #1 (permalink)  
Antiguo 29/10/2013, 19:17
 
Fecha de Ingreso: junio-2013
Mensajes: 11
Antigüedad: 10 años, 9 meses
Puntos: 0
traer datos a un input con espacios

ESTE ES M ICODIGO.. LO QUE PASA ES Q SI JALA MI BASE DE DATOS A LOS INPUT PERO SOLO JALA HASTA ANTES DEU NESPACIO.. EJEMPLO Jean carlos .. solo jala Jean.. como arreglo eso ?


Código PHP:
$s=$_REQUEST["search"];
$sql="select *from Personas where Nombre ='$s'";
$rs=mysql_query($sql,$db);
if($fila=mysql_fetch_array($rs)){?>
<table border='1'>
<tr>
<td width="58">Nombre</td><td width="167"><input type="text" value= <?php echo $fila["Nombre"?>></td>
</tr>
<tr>
<td>Direccion</td><td><input type="text" value= <?php echo $fila["Direccion"?>></td>
</tr>
<tr>
<td>Mail</td><td><input type="text" value= <?php echo $fila["Mail"?>></td>
</tr>
<tr>
<td>Telefono</td><td><input type="text" value= <?php echo $fila["Telefono"?>></td>
</tr>
</table>
  #2 (permalink)  
Antiguo 29/10/2013, 19:19
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: traer datos a un input con espacios

Todos los atributos de HTML deben tener comillas, está claro que en los value no estás usando comillas.

Código PHP:
Ver original
  1. <!-- MAL -->
  2. <input value=<?php echo $var; ?> />
  3.  
  4. <!-- BIEN -->
  5. <input value="<?php echo $var; ?>" />
  6.  
  7. <!-- PERFECTO -->
  8. <input value="<?php echo htmlspecialchars($var); ?>" />

¿Se entiende?
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #3 (permalink)  
Antiguo 29/10/2013, 19:39
 
Fecha de Ingreso: junio-2013
Mensajes: 11
Antigüedad: 10 años, 9 meses
Puntos: 0
Respuesta: traer datos a un input con espacios

si gracias amigo .. con el Bien .. fue suficiente ^^

Etiquetas: espacios, input, select, sql
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 14:29.