header("location:../index.php?str=erro"); } if (isset($_POST["vchEmail"]) && $_POST['vchEmail'] != '') { $contato->setVchEmail($_POST["vchEmail"]); } else { header("location:../index.php?str=erro"); } if (isset($_POST["vchAssunto"]) && $_POST['vchAssunto'] != '') { $contato->setVchAssunto($_POST["vchAssunto"]); } else { header("location:../index.php?str=erro"); } if (isset($_POST["txtMensagem"]) && $_POST['txtMensagem'] != '') { $contato->setTxtMsg($_POST["txtMensagem"]); } else { header("location:../index.php?str=erro"); } $con = new PDO("mysql:host=mysql.hostinger.com.br;dbname=u157910548_aluno", "u157910548_jack", "j34602796"); //$con = new PDO("mysql:host=localhost;dbname=u157910548_aluno","root",""); $stmt = $con->prepare('insert into contatos(vchNome,vchEmail,vchAssunto,txtMensagem) values (?,?,?,?)'); $stmt->bindValue(1, $contato->getVchNome()); $stmt->bindValue(2, $contato->getVchEmail()); $stmt->bindValue(3, $contato->getVchAssunto()); $stmt->bindValue(4, $contato->getTxtMsg()); $stmt->execute(); if ($stmt->errorCode() > 0) { var_dump($stmt->errorInfo()); die; } else { header("location:../pages/ENG_USA/contactUs.php?tipoMsg=successo"); }