Raro Raro Raro Raro ...... Gracias pero asi esta hecho lo que pasa es que al no recargar la pagina no entra otra vez en el if pero si guada los datos en la base de datos (es rarisimo ya he hecho mogollon de pag parecidas y nunca me ha pasado esto). os dejo el codigo para ver si pillais el problema si pongo un boton submit normal envez de un JPG si que la recarga
lo mas curioso es q si guarda los datos en la base de datos pero NO RECARGA LA PAGINA
alta_cliente.php
<?php
session_name("SES");
session_start ();
header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" );
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
?>
<html>
<head>
<title>AMBARSTOCK.COM</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<LINK href="css/estilo.css" rel=stylesheet>
</head>
<script language="JavaScript">
<!--
function Quitar_Espacios_JS(CUAL){
while (document.getElementById(CUAL).value.charAt(0) == " ")
document.getElementById(CUAL).value = document.getElementById(CUAL).value.substr(1, document.getElementById(CUAL).value.length - 1);
while (document.getElementById(CUAL).value.charAt(docume nt.getElementById(CUAL).value.length - 1) == " ")
document.getElementById(CUAL).value = document.getElementById(CUAL).value.substr(0, document.getElementById(CUAL).value.length - 1);
return document.getElementById(CUAL).value;
}
//-->
function Comprobar(){
if ( ( (document.formulario.Condiciones.checked) != "1" ) )
{
alert("Ha de aceptar las condiciones de uso para darse de alta como cliente");
return;
}
if ( ( (document.formulario.Nombre.value) == "" ) )
{
alert("No ha escrito su Nombre");
return;
}
if ( ( (document.formulario.Apellido.value) == "" ) )
{
alert("No ha escrito su Apellido");
return;
}
if ( ( (document.formulario.E_Mail.value) == "" ) )
{
alert("No ha escrito su E_Mail");
return;
}
if ( ( (document.formulario.Contrasena.value) == "" ) )
{
alert("No ha escrito su Contrasena");
return;
}
if ( ( (document.formulario.Confirmar.value) == "" ) )
{
alert("No ha escrito su Confirmar Contrasena");
return;
}
if ( ( (document.formulario.Confirmar.value) != (document.formulario.Contrasena.value) ) )
{
alert("La contraseña y su confirmacion no coinciden");
return;
}
if ( ( (document.formulario.Direccion.value) == "" ) )
{
alert("No ha escrito su Direccion");
return;
}
if ( ( (document.formulario.Cod_Postal.value) == "" ) )
{
alert("No ha escrito su Cod_Postal");
return;
}
if ( ( (document.formulario.Ciudad.value) == "" ) )
{
alert("No ha escrito su Ciudad");
return;
}
if ( ( (document.formulario.Pais.value) == "0" ) )
{
alert("No ha seleccionado su Pais");
return;
}
if ( ( (document.formulario.Europeo.value) == "0" ) )
{
alert("No ha seleccionado si Pertenece a la Communidad Economica Europea");
return;
}
document.formulario.submit();
}
//-->
</script>
<body topmargin="0" bgcolor="#475364">
<?php
$Host = "localhost";
$User = "";
$Password = "";
$DBName = "ambar";
$TableName_Clientes = "clientes";
$Link = mysql_connect ($Host, $User, $Password);
?>
<?php
if ($Alta_Cliente == 1){
print("<table width=\"500\" border=\"0\" align=\"center\" cellpadding=\"4\" cellspacing=\"4\" class=\"gris\">");
print("<tr><td class=gris>");
//estudio el check de recibir novedades
if ($Novedades == 1){
$Novedades = "SI Recibir";
}else{
$Novedades = "NO Recibir";
}
//estudio el check de Condiciones
if ($Condiciones == 1){
$Condiciones = "SI Acepto Condiciones";
}else{
$Condiciones = "NO Acepto Condiciones";
}
$Fecha_Alta = date("Y-m-d");
$Ultima_Visita = date("Y-m-d H:i:00");
$Num_Visitas = 0;
//GRABO LOS DATOS EN BDD
$Query_Alta = "INSERT INTO $TableName_Clientes
(Apellido, Nombre, E_Mail, Contrasena, Direccion,
Cod_Postal, Ciudad, Pais, Telefono, Fax, Empresa, Novedades,
Fecha_Alta, Ultima_Visita, Num_Visitas, Nom_Empresa, Europeo )
VALUES
('$Apellido', '$Nombre', '$E_Mail', '$Contrasena', '$Direccion',
'$Cod_Postal', '$Ciudad', '$Pais', '$Telefono', '$Fax', '$Empresa', '$Novedades',
'$Fecha_Alta', '$Ultima_Visita', '$Num_Visitas', '$Nom_Empresa', '$Europeo')";
// '$Fecha_Alta', '$Ultima_Visita', '$Num_Visitas')";
print("<br>$Query_Alta<br>");
if (mysql_db_query ($DBName, $Query_Alta, $Link)) {
print ("Las datos se registraron en la base de datos!<BR>");
} else {
print ("ERROR AL CONECTARSE CON LA BASE DE DATOS!! Los datos no se ha podido grabar.<BR>Inténtelo de nuevo más tarde.<br>");
}
print("</td></tr></table>");
}else{
?>
__________________ "No tengas miedo de ir despacio, teme quedarte quieto." |