OBS: o html com o form esta em uma pasta e o parceiroconf.php esta na raiz (Estou usando smarty), por favor se fosse normal esta correto?
/parceiroconf.php
/templates/parceiro.tpl
<form action="../parceiroconf.php" method="post" name="formparceiro"> <tr> <td width="395px" height="25">Nome:</td> <td><input name="txtnome" type="text" size="40" maxlength="80" /></td> </tr> <tr> <td width="395px">Data Nascimento:</td> <td><input name="txtdatanascimento" type="text" size="12" maxlength="12" /></td> </tr> <tr> <td width="395px">Endereço:</td> <td><input name="txtendereco" type="text" size="40" maxlength="80" /></td> </tr> <tr> <td width="395px">Bairro:</td> <td><input name="txtbairro" type="text" size="40" maxlength="80" /></td> </tr> <tr> <td width="395px">email:</td> <td><input name="txtemail" type="text" size="40" maxlength="80" /></td> </tr> <tr> <td width="395px">telefone</td> <td><input name="txttelefone" type="text" size="20" maxlength="50" /></td> </tr> <tr> <td width="395px">Celular:</td> <td><input name="txtcelular" type="text" size="20" maxlength="50" /></td> </tr> <tr> <td><input type="submit" name="BTEnvia" value="Enviar" /></td> </tr> </form>
Parceiroconf.php
$nome= $_POST["txtnome"]; $datanascimento=$_POST["txtdatanascimento"]; $endereco=$_POST["txtendereco"]; $bairro=$_POST["txtbairro"]; $email=$_POST["txtemail"]; $telefone=$_POST["txttelefone"]; $celular=$_POST["txtcelular"]; //Ligação à base // -- Acesso ao BD -- $servidor = *****; $usuario = *****; $senha = ******; $banco = ******; $con = mysql_connect($servidor, $usuario, $senha); if (!$con) { die('Não foi possivel ser feita a conexão ' . mysql_error()); } //Escolha da base de dados mysql_select_db("tblboletins",$con); //inserção na base de dados (ta qq coisa mal) //mysql_query("insert into tblboletins (idboletim,nome,datanascimento,endereco,bairro,email,telefone,celular) values ('$nome','$datanascimento','$endereco','$bairro','$email','$telefone','$celular')"); $sql = mysql_query("insert into 'evertonpopmt'.'tblboletins' ('idboletim','nome','datanascimento','endereco','bairro','email','telefone','celular') values (NULL , '$nome','$datanascimento','$endereco','$bairro','$email','$telefone','$celular')"); if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con); ?>