Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

mateus paina

dados nao chega

Recommended Posts

ola pessoal, sou iniciante e estou com um problema, minha pagina funciona normal, só que quando coloco na hospedagem ela nao envia os dados pro banco de dados, só envia os dados quando esta no localhost, alguem me ajuda? desde ja agradeço

conexao...

<?php

# FileName="Connection_php_mysql.htm"

# Type="MYSQL"

# HTTP="true"

$hostname_conexao = "localhost";

$database_conexao = "teste";

$username_conexao = "paina";

$password_conexao = "minhasenha";

$conexao = mysql_pconnect($hostname_conexao, $username_conexao, $password_conexao) or trigger_error(mysql_error(),E_USER_ERROR);

?>

CADASTRO....

<?php require_once('Connections/conexao.php'); ?>

<?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 cadastrar (nome, email, sexo, mensagem) VALUES (%s, %s, %s, %s)",

GetSQLValueString($_POST['nome'], "text"),

GetSQLValueString($_POST['email'], "text"),

GetSQLValueString($_POST['sexo'], "text"),

GetSQLValueString($_POST['mensagem'], "text"));

mysql_select_db($database_conexao, $conexao);

$Result1 = mysql_query($insertSQL, $conexao) or die(mysql_error());

$insertGoTo = "finalizar.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>cadastrar</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">Nome:</td>

<td><input type="text" name="nome" value="" size="32" /></td>

</tr>

<tr valign="baseline">

<td nowrap="nowrap" align="right">Email:</td>

<td><input type="text" name="email" value="" size="32" /></td>

</tr>

<tr valign="baseline">

<td nowrap="nowrap" align="right">Sexo:</td>

<td><input type="text" name="sexo" value="" size="32" /></td>

</tr>

<tr valign="baseline">

<td nowrap="nowrap" align="right">Mensagem:</td>

<td><input type="text" name="mensagem" value="" size="32" /></td>

</tr>

<tr valign="baseline">

<td nowrap="nowrap" align="right"> </td>

<td><input type="submit" value="Inserir registro" /></td>

</tr>

</table>

<input type="hidden" name="MM_insert" value="form1" />

</form>

<p> </p>

</body>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Não use nenhum código pronto.

Evite criar o front-end com tabela. Tabelas somente quando realmente forem dados tabulares.

Se quer aprender o básico sem depender de Dreamweaver, tem o básico na internet...

http://www.devmedia.com.br/crud-com-php-pdo/28873

Entendendo o processo, você saberá como corrigir os erros que podem vir a acontecer. Dificilmente a galera irá te ajudar pq você pegou um código pronto.

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.