To being with, Im really bad with PHP, not my area. Sorry for any stupid stuff I might say
EDIT: I tried echoing the vars as you guys sayd to, and comes out I cant get any value out of it.
EDIT2: Those “class required” works for my jquery validation script. You guys think i should post it too?
Well, im facing a php contact form problem. I dont know much about php too, so this make stuff harder.
Well, I’ve tried mailtest.php to check if it was my hosting, but it is working ok. So here is the code:
<form class="validate" method="post" action="send_form_email.php">
<span class="fill">Todos os campos são obrigatórios.</span>
<span><label>Nome:</label><input name="nome" type="text" class="required" /></span><br />
<span><label>E-mail:</label><input name="mail" type="text" class="required email" /></span><br />
<span><label>Empresa:</label><input name="empresa" type="text" class="required" /></span><br />
<span><label>Telefone:</label><input style="width: 150px;" name="phone" type="text" class="required" /></span><br />
<span><label>Mensagem:</label><textarea name="mensagem" cols="38" rows="8" class="required"></textarea></span><br />
<span><input class="btn" type="submit" name="submit" value="Enviar" /></span>
</form>
And here it is my php coding:
<?php
if(isset($_POST['submit'])) {
$to = "fernando_fleury@hotmail.com";
$subject = "Contato Website - Nicotec";
$name = $_POST['nome'];
$email = $_POST['mail'];
$empresa = $_POST['empresa'];
$phone = $_POST['phone'];
$message = $_POST['mensagem'];
$body = "De: $name_field\n E-Mail: $email\n Empresa: $empresa\n Telefone: $phone\n Mensagem:\n $message";
mail($to, $subject, $body);
}
header('Location: contato.html');
?>
It is possible to check it live too on: http://www.fernandofleury.com.br/preview/nicotec/contato.html
What am i doing wrong here? Thanks in advance.
Rather than
if(isset($_POST['submit']))check to make sure that all of your required fields are set along the lines ofif(isset($_POST['nome']) && isset($_POST['mail']) && isset($_POST['phone']) ....Then if that fails, echo out the
$to,$subjectand$body. Comment out theheaderto see the results while you test it.Also, try this:
edit: to echo out a var to the screen use (in the example of
$tothis code:Edit 2:
I had a look at your page and you use javascript to ensure that all the fields are filled in. Therefore, the problem almost certainly lies in this line:
Can you change it to:
for me please? Perhaps the
$_POST['Submit']isn’t being sent properly.