Ver Mensaje Individual
  #4 (permalink)  
Antiguo 30/03/2012, 11:55
juangemelo01
 
Fecha de Ingreso: marzo-2011
Ubicación: Oaxaca
Mensajes: 252
Antigüedad: 13 años, 1 mes
Puntos: 17
Respuesta: Problema con casillas de validacion

Gracias Trublux por responder, este es el codigo de toda mi pagina
Código PHP:
<?php require_once('Connections/dinorpg.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 
"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 dinos (NDino, Maestro, PFuego, PAgua, PMadera, PElec, PAire, Nivel, HP, AFuego, AAgua, AMadera, Aelec, AAire, Imagen) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['NDino'], "text"),
                       
GetSQLValueString($_POST['Maestro'], "text"),
                       
GetSQLValueString($_POST['PFuego'], "int"),
                       
GetSQLValueString($_POST['PAgua'], "int"),
                       
GetSQLValueString($_POST['PMadera'], "int"),
                       
GetSQLValueString($_POST['PElec'], "int"),
                       
GetSQLValueString($_POST['PAire'], "int"),
                       
GetSQLValueString($_POST['Nivel'], "int"),
                       
GetSQLValueString($_POST['HP'], "int"),
                       
GetSQLValueString($_POST['AFuego'], "text"),
                       
GetSQLValueString($_POST['AAgua'], "text"),
                       
GetSQLValueString($_POST['AMadera'], "text"),
                       
GetSQLValueString($_POST['Aelec'], "text"),
                       
GetSQLValueString($_POST['AAire'], "text"),
                       
GetSQLValueString($_POST['Imagen'], "text"));

  
mysql_select_db($database_dinorpg$dinorpg);
  
$Result1 mysql_query($insertSQL$dinorpg) or die(mysql_error());

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

if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  
$insertSQL sprintf("INSERT INTO dinos (NDino, Maestro, PFuego, PAgua, PMadera, PElec, PAire, Nivel, HP, AFuego, AAgua, AMadera, Aelec, AAire, Imagen) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['NDino'], "text"),
                       
GetSQLValueString($_POST['Maestro'], "text"),
                       
GetSQLValueString($_POST['PFuego'], "int"),
                       
GetSQLValueString($_POST['PAgua'], "int"),
                       
GetSQLValueString($_POST['PMadera'], "int"),
                       
GetSQLValueString($_POST['PElec'], "int"),
                       
GetSQLValueString($_POST['PAire'], "int"),
                       
GetSQLValueString($_POST['Nivel'], "int"),
                       
GetSQLValueString($_POST['HP'], "int"),
                       
GetSQLValueString($_POST['AFuego'], "text"),
                       
GetSQLValueString($_POST['AAgua'], "text"),
                       
GetSQLValueString($_POST['AMadera'], "text"),
                       
GetSQLValueString($_POST['Aelec'], "text"),
                       
GetSQLValueString($_POST['AAire'], "text"),
                       
GetSQLValueString($_POST['Imagen'], "text"));

  
mysql_select_db($database_dinorpg$dinorpg);
  
$Result1 mysql_query($insertSQL$dinorpg) or die(mysql_error());
}

mysql_select_db($database_dinorpg$dinorpg);
$query_alta "SELECT * FROM dinos";
$alta mysql_query($query_alta$dinorpg) or die(mysql_error());
$row_alta mysql_fetch_assoc($alta);
$totalRows_alta mysql_num_rows($alta);
?>
Esto es lo que va en la parte superior de mi documento