Foros del Web » Programando para Internet » PHP »

Problemas de variable

Estas en el tema de Problemas de variable en el foro de PHP en Foros del Web. Como defino esa variable???? Notice: Undefined index: nombre in C:\xampp\htdocs\libre\contactos\process.php on line 142 Código PHP: $recipiente  =  "[email protected]" ; $asunto  =  "Comentario del Sitio" ; $error  =  ...
  #1 (permalink)  
Antiguo 15/01/2013, 03:44
 
Fecha de Ingreso: agosto-2011
Mensajes: 165
Antigüedad: 12 años, 8 meses
Puntos: 1
Problemas de variable

Como defino esa variable????

Notice: Undefined index: nombre in C:\xampp\htdocs\libre\contactos\process.php on line 142


Código PHP:
$recipiente "[email protected]";
$asunto "Comentario del Sitio";
$error 0;
$nombre $_POST['nombre'];
$email $_POST['email'];
$direccion $_POST['direccion'];
$localidad $_POST['localidad'];
$comentario $_POST['comentario'];
if(
$nombre == "" ||  $email == "" || $comentario == ""
  #2 (permalink)  
Antiguo 15/01/2013, 04:37
Avatar de CoriaWeb  
Fecha de Ingreso: septiembre-2012
Ubicación: Coria del Río - Sevilla
Mensajes: 1.795
Antigüedad: 11 años, 7 meses
Puntos: 130
Respuesta: Problemas de variable

Y cual es la linea 142?
__________________
Hosting de Calidad
Servidores Dedicados Administrados
CoriaWeb.hosting
  #3 (permalink)  
Antiguo 15/01/2013, 04:59
 
Fecha de Ingreso: agosto-2011
Mensajes: 165
Antigüedad: 12 años, 8 meses
Puntos: 1
Respuesta: Problemas de variable

Te he puesto la 1 la 142 pero son todas

Nombre
email
direccion
localidad
comentario

Notice: Undefined index: nombre in C:\xampp\htdocs\libre\contactos\process.php on line 142

Notice: Undefined index: email in C:\xampp\htdocs\libre\contactos\process.php on line 143

Notice: Undefined index: direccion in C:\xampp\htdocs\libre\contactos\process.php on line 144

Notice: Undefined index: localidad in C:\xampp\htdocs\libre\contactos\process.php on line 145

Notice: Undefined index: comentario in C:\xampp\htdocs\libre\contactos\process.php on line 146


A la espera de respuesta
  #4 (permalink)  
Antiguo 15/01/2013, 05:09
Avatar de CoriaWeb  
Fecha de Ingreso: septiembre-2012
Ubicación: Coria del Río - Sevilla
Mensajes: 1.795
Antigüedad: 11 años, 7 meses
Puntos: 130
Respuesta: Problemas de variable

oka haber, como llegas a esta pag? es decir el formulario lo recibes desde otra pagina o trabaja sobre la misma? ejemplo, vienen de formulario.html a procesar.php o va de procesar.php a procesar.php.. espero me hayas entendido la pregunta :D
__________________
Hosting de Calidad
Servidores Dedicados Administrados
CoriaWeb.hosting
  #5 (permalink)  
Antiguo 15/01/2013, 06:14
 
Fecha de Ingreso: agosto-2011
Mensajes: 165
Antigüedad: 12 años, 8 meses
Puntos: 1
Respuesta: Problemas de variable

El formalario es html


<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table width="517" align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Nombre:</td>
<td><input type="text" name="nombre" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Email:</td>
<td><input type="text" name="email" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Direccion:</td>
<td><input type="text" name="direccion" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Localidad:</td>
<td><input type="text" name="localidad" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td align="right" valign="top" nowrap="nowrap">Comentario:</td>
<td><textarea name="comentario" cols="50" rows="6"></textarea></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">&nbsp;</td>
<td><input name="submit" type="submit" id="submit" value="Insertar registro" />
<input name="reset" type="reset" value='Borrar todo' /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
  #6 (permalink)  
Antiguo 15/01/2013, 06:50
 
Fecha de Ingreso: septiembre-2012
Ubicación: Argentina
Mensajes: 144
Antigüedad: 11 años, 7 meses
Puntos: 12
Respuesta: Problemas de variable

Buenas!!

porque el formulario tiene esta variable

<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">

Que contiene $editFormAction.??
  #7 (permalink)  
Antiguo 15/01/2013, 09:37
 
Fecha de Ingreso: agosto-2011
Mensajes: 165
Antigüedad: 12 años, 8 meses
Puntos: 1
Respuesta: Problemas de variable

Creo que eso tuvo que ser alguna prueba en teoria seria asi

pero tampoco va bien sigue el mismo error

En localhost me da estos errores,
si lo subo a internet e intento envia el formulario me da este error

Unknown column 'direccion' in 'field list'

Código PHP:
<form action="contacto/process.php" method="post">
                                  </
form>
      <
form action="process.php" method="post" name="form1" id="form1">
        <
table width="517" align="center">
          <
tr valign="baseline">
            <
td nowrap="nowrap" align="right">Nombre:</td>
            <
td><input type="text" name="nombre" value="" size="32" /></td>
          </
tr>
          <
tr valign="baseline">
            <
td nowrap="nowrap" align="right">Email:</td>
            <
td><input type="text" name="email" value="" size="32" /></td>
          </
tr>
          <
tr valign="baseline">
            <
td nowrap="nowrap" align="right">Direccion:</td>
            <
td><input type="text" name="direccion" value="" size="32" /></td>
          </
tr>
          <
tr valign="baseline">
            <
td nowrap="nowrap" align="right">Localidad:</td>
            <
td><input type="text" name="localidad" value="" size="32" /></td>
          </
tr>
          <
tr valign="baseline">
            <
td align="right" valign="top" nowrap="nowrap">Comentario:</td>
            <
td><textarea name="comentario" cols="50" rows="6"></textarea></td>
          </
tr>
          <
tr valign="baseline">
            <
td nowrap="nowrap" align="right">&nbsp;</td>
            <
td><input name="submit" type="submit" id="submit" value="Insertar registro" />
            <
input name="reset" type="reset" value='Borrar todo' /></td>
          </
tr>
        </
table>
        <
input type="hidden" name="MM_insert" value="form1" />
      </
form

Última edición por yolanda16568; 15/01/2013 a las 09:42
  #8 (permalink)  
Antiguo 15/01/2013, 09:49
 
Fecha de Ingreso: septiembre-2012
Ubicación: Argentina
Mensajes: 144
Antigüedad: 11 años, 7 meses
Puntos: 12
Respuesta: Problemas de variable

Proba sacando <form action="contacto/process.php" method="post"> </form>

Ademas sacale el Id al form <form action="process.php" method="post" name="form1" id="form1">

y hace lo siguiente antes de las variables

if (isset($_POST['submit']))
{$recipiente = "[email protected]";
$asunto = "Comentario del Sitio";
$error = 0;
$nombre = $_POST['nombre'];
$email = $_POST['email'];
$direccion = $_POST['direccion'];
$localidad = $_POST['localidad'];
$comentario = $_POST['comentario'];

}
  #9 (permalink)  
Antiguo 15/01/2013, 10:08
 
Fecha de Ingreso: agosto-2011
Mensajes: 165
Antigüedad: 12 años, 8 meses
Puntos: 1
Respuesta: Problemas de variable

if($nombre == "" || $email == "" || $comentario == ""){

error linea 155 es la de arriba se me quitan los demas errores
quedaria asi:




Código PHP:
   <form action="process.php" method="post">
                                  </form>
      <form action="process.php" method="post" name="form1" id="form1">
        <table width="517" align="center">
          <tr valign="baseline">
            <td nowrap="nowrap" align="right">Nombre:</td>
            <td><input type="text" name="nombre" value="" size="32" /></td>
          </tr>
          <tr valign="baseline">
            <td nowrap="nowrap" align="right">Email:</td>
            <td><input type="text" name="email" value="" size="32" /></td>
          </tr>
          <tr valign="baseline">
            <td nowrap="nowrap" align="right">Direccion:</td>
            <td><input type="text" name="direccion" value="" size="32" /></td>
          </tr>
          <tr valign="baseline">
            <td nowrap="nowrap" align="right">Localidad:</td>
            <td><input type="text" name="localidad" value="" size="32" /></td>
          </tr>
          <tr valign="baseline">
            <td align="right" valign="top" nowrap="nowrap">Comentario:</td>
            <td><textarea name="comentario" cols="50" rows="6"></textarea></td>
          </tr>
          <tr valign="baseline">
            <td nowrap="nowrap" align="right">&nbsp;</td>
            <td><input name="submit" type="submit" id="submit" value="Insertar registro" />
            <input name="reset" type="reset" value='Borrar todo' /></td>
          </tr>
        </table>
        <input type="hidden" name="MM_insert" value="form1" />
      </form>
      <?php
       
if (isset($_POST['submit']))
{
$recipiente "[email protected]"
$asunto "Comentario del Sitio"
$error 0
$nombre $_POST['nombre']; 
$email $_POST['email']; 
$direccion $_POST['direccion']; 
$localidad $_POST['localidad']; 
$comentario $_POST['comentario'];
if(
$nombre == "" ||  $email == "" || $comentario == ""){
   
$error=1;
}

Etiquetas: variables
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 03:47.