Miren ando en busca de su ayuda por el siguiente problema es que no logro que estos datos se guarden en la base de datos: tengo este codigo :
Código PHP:
<?php require_once('Connections/localhost.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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 formulario (categoria, combo2, combo3) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['combo1'], "int"),
GetSQLValueString($_POST['combo2'], "int"),
GetSQLValueString($_POST['combo3'], "int"));
mysql_select_db($database_localhost, $localhost);
$Result1 = mysql_query($insertSQL, $localhost) or die(mysql_error());
$insertGoTo = "anuncio_creado.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Combos dependientes</title>
<script language="javascript" src="js/jquery-1.2.6.min.js"></script>
<script language="javascript">
$(document).ready(function(){
// Parametros para e combo1
$("#combo1").change(function () {
$("#combo1 option:selected").each(function () {
//alert($(this).val());
elegido=$(this).val();
$.post("combo1.php", { elegido: elegido }, function(data){
$("#combo2").html(data);
$("#combo3").html("");
});
});
})
// Parametros para el combo2
$("#combo2").change(function () {
$("#combo2 option:selected").each(function () {
//alert($(this).val());
elegido=$(this).val();
$.post("combo2.php", { elegido: elegido }, function(data){
$("#combo3").html(data);
});
});
})
});
</script>
</head>
<body>
<p> </p>
<p> </p>
<form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
<select name="combo1" id="combo1" size="10">
<option value="-" selected="selected">Seleccionar</option>
<option value="op1_6">Clases / Talleres</option>
<option value="op1_2">Compra y Venta</option>
<option value="op1_4">Empleo</option>
<option value="op1_8">Gratis</option>
<option value="op1_3">Inmuebles</option>
<option value="op1_5">Viajes - Turismo</option>
<option value="op1_7">Servicios</option>
<option value="op1_1">Vehiculos</option>
</select>
<select name="combo2" id="combo2" size="10">
</select>
<select name="combo3" id="combo3" size="10">
</select>
<label>
<input type="submit" name="button" id="button" value="Enviar" />
</label>
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p> </p>
</body>
</html>
sigue..