Buenas a todos, empece con vosotros esta aventura de crear una Web y poco a poco e pasado de HTML a PHP aunque sigo siendo un novato.....
Esta es mi primera gran duda que tengo y no se si es el lugar adecuado pero el tema es que después de enviar el formulario de la pagina contactos me tiene que dirigir a otra pagina de agradecimiento y no lo hace.
Con el servidor local si funciona pero con el de pago no.
E consultado infinidad de foros y también en el servidor Sered que es donde tengo la Web : www.elllagosti.com
La pagina es con plantillas gratis que encontré en videotutoriales : http://blog.templatemonster.com/free-website-templates/
Bueno a lo que iba, el fallo esta que no redirige a la otra pagina y este es el código :
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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 tblcontactos (strNombre, strEmail, intInteres, strComentarios) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['strNombre'], "text"),
GetSQLValueString($_POST['strEmail'], "text"),
GetSQLValueString($_POST['intInteres'], "int"),
GetSQLValueString($_POST['strComentarios'], "text"));
mysql_select_db($database_seredelllagosti, $seredelllagosti);
$Result1 = mysql_query($insertSQL, $seredelllagosti) or die(mysql_error());
$insertGoTo = "contacto_ok.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
Según e visto en todos los foros que e visitado veo supuestas soluciones que no me funcionan y me comentan que el header no debe de estar donde esta lo e cambiado y nada.
Si tenéis alguna sugerencia os lo agradecería...
Saludos.
Esta es mi primera gran duda que tengo y no se si es el lugar adecuado pero el tema es que después de enviar el formulario de la pagina contactos me tiene que dirigir a otra pagina de agradecimiento y no lo hace.
Con el servidor local si funciona pero con el de pago no.
E consultado infinidad de foros y también en el servidor Sered que es donde tengo la Web : www.elllagosti.com
La pagina es con plantillas gratis que encontré en videotutoriales : http://blog.templatemonster.com/free-website-templates/
Bueno a lo que iba, el fallo esta que no redirige a la otra pagina y este es el código :
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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 tblcontactos (strNombre, strEmail, intInteres, strComentarios) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['strNombre'], "text"),
GetSQLValueString($_POST['strEmail'], "text"),
GetSQLValueString($_POST['intInteres'], "int"),
GetSQLValueString($_POST['strComentarios'], "text"));
mysql_select_db($database_seredelllagosti, $seredelllagosti);
$Result1 = mysql_query($insertSQL, $seredelllagosti) or die(mysql_error());
$insertGoTo = "contacto_ok.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
Según e visto en todos los foros que e visitado veo supuestas soluciones que no me funcionan y me comentan que el header no debe de estar donde esta lo e cambiado y nada.
Si tenéis alguna sugerencia os lo agradecería...
Saludos.