Ver Mensaje Individual
  #3 (permalink)  
Antiguo 06/03/2012, 10:09
mktalternativa
 
Fecha de Ingreso: enero-2012
Mensajes: 224
Antigüedad: 12 años, 3 meses
Puntos: 1
Respuesta: Problema con option Value y PHP

Hola Gracias , puse empleados[] y me guarda el registro como array , probe poner lo que me pasaste de asignatura en action.php pero sigo con el mismo problema te pido disculpas por la molestia quizas estoy hacviendo algo mal





action.php
Código PHP:




<?php require_once('Connections/localhost.php'); ?>

 <?php $tiempo date("Y-m-d ");  ;
  
  

                
$can_dias ;
                
$can_dias2 ;
                
$can_dias3 ;
                
                
                
$f1 date("Y-m-d") ;
                
                
$tiempo2 date("Y-m-d"strtotime("$f1 - $can_dias3 days")); 
                
$verdedate("Y-m-d"strtotime("$f1 + $can_dias days")); 
                
$amarillodate("Y-m-d"strtotime("$f1 + $can_dias2 days")); 
                
$rojodate("Y-m-d"strtotime("$f1 + $can_dias3 days")); 
                
                
$verde2date("Y-m-d"strtotime("$tiempo2 - $can_dias days")); 
                
$amarillo2date("Y-m-d"strtotime("$tiempo2 - $can_dias2 days")); 
                
$rojo2date("Y-m-d"strtotime("$tiempo2 - $can_dias3 days")); 
                
                
                
$diferencia $f1 $amarillo ;
                
                
                
                if (isset(
$_POST['empleados'])) 

   
$asignaturas $_POST['empleados']; 
   foreach (
$asignaturas as $value
  { 
     
//Visualizamos los elementos del array 
     
echo $value."<br>";   
   } 
}  

                
                
                  
$separar explode("|"$value); 

$nombre $separar[0]; 
$email $separar[1]; 
$foto $separar[2]; 
 
  echo 
$separar[0]; 
 echo 
$separar[2]; 


 

?>
<br />



<?php
$normal 
'normal' ;
$normal2 'normal2' ;



function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? "'" doubleval($theValue) . "'" "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}

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

if ( 
$_POST["estado"] == $normal

 {
 
 
 

if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  
$insertSQL sprintf("INSERT INTO tareas (empleado, titulo, descripcion,  fechadecarga, verde, amarillo, rojo, dif,  email) VALUES ('$separar[0]',  %s, %s, '$tiempo', '$verde', '$amarillo', '$rojo', '$diferencia', '$separar[2]')",
                       
                       
GetSQLValueString($_POST['titulo'], "text"),
                       
GetSQLValueString($_POST['detalle'], "text"));
                       

  
mysql_select_db($database_localhost$localhost);
  
$Result1 mysql_query($insertSQL$localhost) or die(mysql_error());

  
$insertGoTo "exitocarga.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}


}
 else  
 
 {
 
if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  
$insertSQL sprintf("INSERT INTO tareas (empleado, titulo, descripcion,  fechadecarga, verde, amarillo, rojo, dif,  email ) VALUES ('$separar[0]',  %s, %s, '$tiempo2', '$verde2', '$amarillo2', '$rojo2', '$diferencia', '$separar[2]' )",
                       
                       
GetSQLValueString($_POST['titulo'], "text"),
                       
GetSQLValueString($_POST['detalle'], "text"));
                       

  
mysql_select_db($database_localhost$localhost);
  
$Result1 mysql_query($insertSQL$localhost) or die(mysql_error());

  
$insertGoTo "exitocarga.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}
}
 
 
mysql_select_db($database_localhost$localhost);
$query_emp "SELECT * FROM empleados";
$emp mysql_query($query_emp$localhost) or die(mysql_error());
$row_emp mysql_fetch_assoc($emp);
$totalRows_emp mysql_num_rows($emp);
?>