Problema com redirecionamento .
Pessoal estou com um problema no redirecionamento da página
apos o cadastro . Eu verifiquei que os dados estão sendo inseridos
nas tabelas , todos corretamente , porem eu definir no Dreamweaver
a pagina que redirecionaria apos o registro e ela não vai de maneira
alguma . Antes eu estava com um problema relacionado a header , então li
em alguns lugares e resolvi botar o <?php ob_start(); e então sumiu
o problema mas o redirecionamento não ocorre .
Mudança apos clicar no botão registrar .
~ Aparece uma "?" no final do link da pagina .
Pagina :
>
<?php require_once('Connections/conec_jogador.php'); ?>
<?php ob_start();
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 usuarios (usu_login, usu_email, usu_senha, usu_senha2, usu_time, usu_local, usu_estadio) VALUES (%s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['usu_login'], "text"),
GetSQLValueString($_POST['usu_email'], "text"),
GetSQLValueString($_POST['usu_senha'], "text"),
GetSQLValueString($_POST['usu_senha2'], "text"),
GetSQLValueString($_POST['usu_time'], "text"),
GetSQLValueString($_POST['usu_local'], "text"),
GetSQLValueString($_POST['usu_estadio'], "text"));
mysql_select_db($database_conec_jogador, $conec_jogador);
$Result1 = mysql_query($insertSQL, $conec_jogador) or die(mysql_error());
$insertGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
?>
<!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">](http://www.w3.org/1999/xhtml%22)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sem título</title>
</head>
<body>
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Login:</td>
<td><input type="text" name="usu_login" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">E-mail:</td>
<td><input type="text" name="usu_email" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Senha:</td>
<td><input type="password" name="usu_senha" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Confirme a Senha:</td>
<td><input type="password" name="usu_senha2" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Nome do Time:</td>
<td><input type="text" name="usu_time" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Cidade/Estado:</td>
<td><input type="text" name="usu_local" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Nome do Estádio:</td>
<td><input type="text" name="usu_estadio" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input type="submit" value="Registrar" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1" />
</form>
<p> </p>
</body>
</html>
Linha cujo atesta erro sem o ob_start() :
header(sprintf("Location: %s", $updateGoTo));
Discussão (4)
Carregando comentários...