Ver Mensaje Individual
  #6 (permalink)  
Antiguo 28/10/2007, 14:49
txino_2
 
Fecha de Ingreso: agosto-2006
Mensajes: 173
Antigüedad: 17 años, 8 meses
Puntos: 1
Re: Fecha y hora actual en formulario PHP

Me respondo a mi mismo, jejeje lo he conseguido

Código PHP:
<?php
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 
"time":
      
$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 ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  
$insertSQL sprintf("INSERT INTO feedsdeportivos (fecha, hora, satelite, frecuencia, polaridad, symbolrate, fec, categoria, transmision, informacion) VALUES (now(), now(), %s, %s, %s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['satelite'], "text"),
                       
GetSQLValueString($_POST['frecuencia'], "text"),
                       
GetSQLValueString($_POST['polaridad'], "text"),
                       
GetSQLValueString($_POST['symbolrate'], "text"),
                       
GetSQLValueString($_POST['fec'], "text"),
                       
GetSQLValueString($_POST['categoria'], "text"),
                       
GetSQLValueString($_POST['transmision'], "text"),
                       
GetSQLValueString($_POST['informacion'], "text"));


  
mysql_select_db($database_feedsdeportivos$feedsdeportivos);
  
$Result1 mysql_query($insertSQL$feedsdeportivos) or die(mysql_error());

  
$insertGoTo "formulario.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}
?>
Dejo el codigo, por si le puede servir a alguien, esto es lo que me faltaba

$insertSQL = sprintf("INSERT INTO feedsdeportivos (fecha, hora, satelite, frecuencia, polaridad, symbolrate, fec, categoria, transmision, informacion) VALUES (now(), now(), %s, %s, %s, %s, %s, %s, %s, %s)",