Ver Mensaje Individual
  #1  
Antiguo 06-06-2006
Avatar de CARLOS E
CARLOS E CARLOS E is offline
Miembro
 
Registrado: may 2006
Posts: 11
Reputación: 0
CARLOS E Va por buen camino
Problemas De Sintaxis If..else

HOLA..
TENGO UNA PAGINA DONDE CAPTURO CIERTOS DATOS Y OTRA DONDE SE MUESTRA CUALES FUERON LOS CAMPOS DONDE NO SE TECLEO INFORMACION(DEBIDO A QUE SERAN OBLIGATORIOS). EL PROBLEMA ES QUE TIEMPO ANTES FUNCIONABA Y HOY NO, NO RECUERDO HABER MODIFICADO EL SCRIPT PERO AUN SIENDO MUY SENCILLO NO HE ENCONTRADO EL ERROR Y ME DESPLIEGA EL TEXTO MOSTRADO ABAJO....
ADEMAS QUE DENTRO DE LAS MISMAS CIRCUNSTANCIAS EN OCASIONES MODIFICO UNA SENTENCIA "IF" Y AL REGRESARLA AL ESTADO ANTERIOR SE COMPORTA DIFERENTE (ME DESPLIEGA UN RESULTADO DISTINTO)..

OTRO PROBLEMA, QUE PASA CON LOS SALTOS DE LINEA? NO VEO QUE ME FUNCIONEN NI EN ESTE NI EN NINGUN SCRIPT

ESPERO HABER EXPRESADO BIEN MI PROBLEMA , GRACIAS!

USO PHP 4.4.2.2

CODIGO::
Código PHP:
<?php
$err_an
=0;
if(
$_post['titulo_an']=="")
{
echo 
"El campo de TITULO es obligatorio \n";
$err_an=1;
}
if(
$_post['descripcion_an']=="")
{
echo 
"El campo de DESCRIPCION es obligatorio \n";
$err_an=1;
}
if(
$_post['categoria_an']=="")
{
echo 
"Debe seleccionar la Categoria \n";
$err_an=1;
}
if(
$_post['subcategoria_an']=="")
{
echo 
"Debe seleccionar la Subcategoria \n";
$err_an=1;
}
$nombre_an$_files['archivo_an']['name'];
$tipo_an$_files['archivo_an']['type'];
$tamaño_an$_files['archivo_an']['size'];
$ruta_an=$_files['tmp_name'];
$contenido_an=addslashes(file_get_contents($ruta_an));
if ( 
$contenido_an != false)
{
if (
$tipo_an=="image/jpeg" || $tipo_an=="image/gif" || $tipo_an=="image_pjpeg" || $tipo_an=="image/bmp")
{
if (
$tamaño_an '102000'
{
echo 
" El tamaño de la imagen debe ser menor a 100 kb. \n";
$err_an=1;
}
}
else
{
echo 
"Solo se aceptan formatos de imagen BMP,JPG y GIF \n";
$err_an=1;
}
}

RESULTADO ::
Cita:

Debe seleccionar la Subcategoria \n"; $err_an=1; } $nombre_an= $_files['archivo_an']['name']; $tipo_an= $_files['archivo_an']['type']; $tamaño_an= $_files['archivo_an']['size']; $ruta_an=$_files['tmp_name']; $contenido_an=addslashes(file_get_contents($ruta_an)); if ( $contenido_an != false) { if ($tipo_an=="image/jpeg" || $tipo_an=="image/gif" || $tipo_an=="image_pjpeg" || $tipo_an=="image/bmp") { if ($tamaño_an > '102000') { echo "
El tamaño de la imagen debe ser menor a 100 kb."; $err_an=1; } } else { echo "Solo se aceptan formatos de imagen BMP,JPG y GIF"; $err_an=1; } } function alta_anuncio (&$res_an, $contenido_an, $tipo_an) { $res_an=0; $conexion_an=mysql_connect("localhost","root",""); if (! $conexion_an) { return $res_an; exit; } else { $db_sel_an=mysqlselect_db("bdregistros", $conexion_an); $sqlx ="insert into anuncios (id_anuncio,id_cte,fecha,hora,titulo_an,descrip,cve_cat,cve_subcat,url,mail,precio,img1,tipo_img,cd, edo,cve_tipo,vigente) values ('0','0000',curdate(),curtime(),'".$_post["titulo_an"]."','".$_post["descripcion_an"]."','01','0100','".$_post["url_an"]."','".$post["correo_an"]."'.'".$_post["precio_an"]."','".$contenido_an."','".$_post["ciudad_an"]."','".post["estado_an"]."',ACCOO','1')"; $result_an=mysql_query($sqlx) or die(mysql_error()); if (! $result_an) { return $res_an; exit; } else { $res_an=1; mysql_close($conexion_an); if(file_exists($ruta_an)) unlink($ruta_an); } } return $res_an; } ?>
__________________
RobiNX
Responder Con Cita