Ver Mensaje Individual
  #3 (permalink)  
Antiguo 13/03/2014, 14:16
mattcreativo
 
Fecha de Ingreso: agosto-2013
Ubicación: San Luis
Mensajes: 21
Antigüedad: 10 años, 8 meses
Puntos: 0
Respuesta: Campos vacio formulario con php

Cita:
Iniciado por enlinea777 Ver Mensaje
Y cual el el problema?????????????????

sin codigo no hay forma de ayudarte
Código PHP:
<?php


$editFormAction 
$_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  
$insertSQL sprintf("INSERT INTO posts (opcion, titulo, minidetalle, contenido, imagen, galeria1, galeria2, mapa, habitaciones, cochera, op) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['opcion'], "text"),
                       
GetSQLValueString($_POST['titulo'], "text"),
                       
GetSQLValueString($_POST['minidetalle'], "text"),
                       
GetSQLValueString($_POST['contenido'], "text"),
                       
GetSQLValueString($_POST['imagen'], "text"),
                       
GetSQLValueString($_POST['galeria1'], "text"),
                       
GetSQLValueString($_POST['galeria2'], "text"),
                       
GetSQLValueString($_POST['mapa'], "text"),
                       
GetSQLValueString($_POST['habitaciones'], "text"),
                       
GetSQLValueString($_POST['cochera'], "text"),
                       
GetSQLValueString($_POST['op'], "text"));

  
mysql_select_db($database_demo$demo);
  
$Result1 mysql_query($insertSQL$demo) or die(mysql_error());

  
$insertGoTo "index.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}
?>
mi problema es que si uno deja el campo galeria1 y galeria2 vacio al colocarlo en nulo se envia con valor nulo hay forma de decirle antes que se envie el registro.

if(empty($_POST['galeria1'])){
insertar un registro en la tabla galeria1 que sea "img/noimagen.jpg"
COMO SE HACE ESTA CONSULTA para insertar en el campo galeria1 la url de una imagen.

}