Ola pessoal estou com um probleminha.....
Ai em baixo esta a validacao e o formulario de minha pagina em php... mais o que esta acontecendo e que a validacao nao esta acontecendo.... os campos estao sendo incluidos em branco no banco de dados e nao esta aparecendo nenhum ---- ERRO !!!
preciso de uma orientacao
Obrigada
Aguardo ajuda
<script Language="javascript">
<!--
function Validar(theForm)
{
if (theForm.t17cantor.value == " ")
{
alert("Favor preencher o campo \"Cantor\".");
theForm.t17cantor.focus();
return (false);
}
if (theForm.t17cantora.value == "")
{
alert("Favor preencher o campo \"Cantora\".");
theForm.t17cantora.focus();
return (false);
}
if (theForm.t17casanoturna.value == "")
{
alert("Favor preencher o campo \"Casa Noturna\".");
theForm.t17casanoturna.focus();
return (false);
}
if (theForm.t17dj.value == "")
{
alert("Favor preencher o campo \"Dj\".");
theForm.t17dj.focus();
return (false);
}
if (theForm.t17apoiocultura.value == "")
(
alert("Favor preencher o campo \"Apoio à Cultura\".");
theForm.t17apoiocultura.focus();
return (false);
)
if (theForm.t17veiculocomunicacao.value == "")
(
alert ("Favor preencher o campo\"Veiculo de Comunicação\".");
theForm.t17veiculocomunicacao.focus();
return (false);
)
if (theForm.t17revelacaoano.value == "")
(
alert ("Favor preencher o campo \"Revelação do Ano\".");
theForm.t17revelacaoano.focus();
return (false);
)
return (true);
}
//-->
</script>
<form method="post" action="cdg_incluir.php" name="form" onSubmit="return Validar(this)">
<table border="0" class="texto">
<tr>
<td width="100" valign="top" align="right">*Cantor:</td>
<td valign="top" align="left">
<input type="text" name="t17cantor" size="85" style="border-color: #000000; border-width: 1; border-style: solid; background-color:#ffffff; font-size: 10; font-family: Arial; color: #000000">
</td>
</tr>
<tr>
<td width="100" valign="top" align="right">*Cantora:</td>
<td valign="top" align="left">
<input type="text" name="t17cantora" size="85" style="border-color:#000000; border-width: 1;
border-style: solid; background-color:#ffffff; font-size:10; font-family: Arial; color:#000000">
</td>
</tr>
<tr>
<td width="100" valign="top" align="right">*Casa Noturna:</td>
<td valign="top" align="left">
<input type="text" name="t17casanoturna" size="85" style="border-color:#000000; border-width: 1;
border-style: solid; background-color:#ffffff; font-size:10; font-family: Arial; color:#000000">
</td>
</tr>
<tr>
<td width="100" valign="top" align="right">*Dj:</td>
<td valign="top" align="left">
<input type="text" name="t17dj" size="85" style="border-color:#000000; border-width: 1;
border-style: solid; background-color:#ffffff; font-size:10; font-family: Arial; color:#000000">
</td>
</tr>
<tr>
<td width="100" valign="top" align="right">*Apoio à Cultura:</td>
<td valign="top" align="left">
<input type="text" name="t17apoiocultura" size="85" style="border-color:#000000; border-width: 1;
border-style: solid; background-color:#ffffff; font-size:10; font-family: Arial; color:#000000">
</td>
</tr>
<tr>
<td width="100" align="right" valign="top">*Veiculo de Comunicação: </td>
<td valign="top" align="left">
<input type="text" name="t17veiculocomunicacao" size="85" style="border-color:#000000; border-width: 1;
border-style: solid; background-color:#ffffff; font-size:10; font-family: Arial; color:#000000">
</td>
</tr>
<tr>
<td width="100" valign="top" align="right">*Revelação do Ano: </td>
<td valign="top" align="left">
<input type="text" name="t17revelacaoano" size="85" style="border-color:#000000; border-width: 1;
border-style: solid; background-color:#ffffff; font-size:10; font-family: Arial; color:#000000">
</td>
</tr>
<tr>
<td colspan="2" valign="top">
<p align="center">
<input type="submit" value="Incluir" name="Incluir" onclick="Validar(this);" style="border-color: #000000; border-width: 1; border-style: solid; background-color:#ffffff; font-size: 10; font-family: Arial; color: #000000; height: 25"></p>
</td>
</tr>
</table>
</form>

Validado Formulario
Started By adrianatrentini, 25/08/2006, 14:30
2 replies to this topic
#1
Posted 25/08/2006, 14:30
#2
Posted 26/08/2006, 00:22
Do if que verifica o campo t17apoiocultura para baixo, está tudo errado. Você trocou o { e } ou ( e ) nos blocos do if.
Fórum WMO - Equipe de Desenvolvimento / Banco de Dados - Ex-Administrador
#3
Posted 28/08/2006, 11:22
Oie
Pessoal agora esta apresentando neste erro:
Notice: Undefined variable: t17cantor in C:\Sites\WbrInternet\sasprod\cdgind_incluir.php on line 15
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '')' at line 1
O codigo a qual o erro se refere e esse !
<? require 'conexao.php';
//Atrubuição dos valores as respectivas variáveis
if (isset($_POST['t17cantor'])){ $tt17cantor = ereg_replace("'","´",$_POST['t17cantor']); }else{ $t17cantor = '';}
if (isset($_POST['tt17cantora'])){ $t17cantora = ereg_replace("'","´",$_POST['t17cantora']); }else{ $t17cantora = '';}
if (isset($_POST['t17casanoturna'])){ $t17casanoturna = ereg_replace("'","´",$_POST['t17casanoturna']); }else{ $t17casanoturna = '';}
if (isset($_POST['t17apoiocultura'])){ $t17apoiocultura = ereg_replace("'","´",$_POST['t17apoiocultura']); }else{ $t17apoiocultura = '';}
if (isset($_POST['t17revelacaoano'])){ $t17revelacaoano = ereg_replace("'","´",$_POST['t17revelacaoano']); }else{ $t17revelacaoano = '';}
if (isset($_POST['t17dj'])){ $t17dj = ereg_replace("'","´",$_POST['t17dj']); }else{ $t17dj = '';}
if (isset($_POST['t17veiculocomunicacao'])){ $t17veiculocomunicacao = ereg_replace("'","´",$_POST['t17veiculocomunicacao']); }else{ $t17veiculocomunicacao = '';}
//Altera os dados na tabela aberta
$sql_query = ("INSERT INTO t17indicacao (t17cantor, t17cantora, t17casanoturna, t17apoiocultura, t17revelacaoano, t17dj, t17veiculocomunicacao) VALUES ('".$t17cantor."','".$t17cantora."','".$t17casanoturna."','".$t17apoiocultura."','".$t17revelacaoano."','".$t17dj."','".$t17veiculocomunicacao."')");
if (!($strQuery = mysql_query($sql_query) or die(mysql_error())))
{
DisplayErrMsg(sprintf("internal error %d:%s\n", mysql_errno(), mysql_error()));
return 0;
}
else
{?>
<script>
window.location.href="sucesso.php";
</script>
<? }?>
Pessoal agora esta apresentando neste erro:
Notice: Undefined variable: t17cantor in C:\Sites\WbrInternet\sasprod\cdgind_incluir.php on line 15
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '')' at line 1
O codigo a qual o erro se refere e esse !
<? require 'conexao.php';
//Atrubuição dos valores as respectivas variáveis
if (isset($_POST['t17cantor'])){ $tt17cantor = ereg_replace("'","´",$_POST['t17cantor']); }else{ $t17cantor = '';}
if (isset($_POST['tt17cantora'])){ $t17cantora = ereg_replace("'","´",$_POST['t17cantora']); }else{ $t17cantora = '';}
if (isset($_POST['t17casanoturna'])){ $t17casanoturna = ereg_replace("'","´",$_POST['t17casanoturna']); }else{ $t17casanoturna = '';}
if (isset($_POST['t17apoiocultura'])){ $t17apoiocultura = ereg_replace("'","´",$_POST['t17apoiocultura']); }else{ $t17apoiocultura = '';}
if (isset($_POST['t17revelacaoano'])){ $t17revelacaoano = ereg_replace("'","´",$_POST['t17revelacaoano']); }else{ $t17revelacaoano = '';}
if (isset($_POST['t17dj'])){ $t17dj = ereg_replace("'","´",$_POST['t17dj']); }else{ $t17dj = '';}
if (isset($_POST['t17veiculocomunicacao'])){ $t17veiculocomunicacao = ereg_replace("'","´",$_POST['t17veiculocomunicacao']); }else{ $t17veiculocomunicacao = '';}
//Altera os dados na tabela aberta
$sql_query = ("INSERT INTO t17indicacao (t17cantor, t17cantora, t17casanoturna, t17apoiocultura, t17revelacaoano, t17dj, t17veiculocomunicacao) VALUES ('".$t17cantor."','".$t17cantora."','".$t17casanoturna."','".$t17apoiocultura."','".$t17revelacaoano."','".$t17dj."','".$t17veiculocomunicacao."')");
if (!($strQuery = mysql_query($sql_query) or die(mysql_error())))
{
DisplayErrMsg(sprintf("internal error %d:%s\n", mysql_errno(), mysql_error()));
return 0;
}
else
{?>
<script>
window.location.href="sucesso.php";
</script>
<? }?>
1 user(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)