html - PHP Contact form not sending email. Not sure if syntax or Server -
hey guys have html document contact form created , not working. have php in seperate php file so:
html:
<form class="form-horizontal" action="form_process.php" method="post" name="contact_form"> <div class="form-group"> <label class="col-sm-2 control-label white-color">email</label> <div class="col-sm-10"> <input type="email" class="form-control" name="email" placeholder="email" required> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label white-color">name</label> <div class="col-sm-10"> <input type="text" class="form-control" name="name" placeholder="first name" required> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label white-color">message</label> <div class="col-sm-10"> <textarea class="form-control" rows="5" placeholder="type message here!" name="message" required></textarea> <button type="submit" class="btn btn-default btn-lg text-center" id="send-btn" name="submit">send</button> </div> </div> </form>
and here php:
<?php if (isset($post['name']) && isset($_post['email'])) { $email = $_post['email']; $name = $_post['name']; $message = $_post['message']; $to = 'j_goris@live.com'; $subject = 'jorgegoris.com form submission'; $text = "name: ".$name."\n"."email: ".$email."\n". "wrote following: "."\n\n".$message; if(mail($to, $subject, $text, "from: ".$name)){ echo '<h1>thanks! shortly.</h1>'; } else { echo 'sorry there error! please try again.'; } }?>
this first time tackling php contact forms. uploaded files server , still no dice. can guys see whats wrong?
replace:
$post['name']
to:
$_post['name']
replace:
if(mail($to, $subject, $text, "from: ".$name)){
to:
if(mail($to, $subject, $text, "from: ".$email)){
full code:
<?php if (isset($_post['name']) && isset($_post['email'])) { $email = $_post['email']; $name = $_post['name']; $message = $_post['message']; $to = 'j_goris@live.com'; $subject = 'jorgegoris.com form submission'; $text = "name: ".$name."\n"."email: ".$email."\n". "wrote following: "."\n\n".$message; if(mail($to, $subject, $text, "from: ".$email)){ echo '<h1>thanks! shortly.</h1>'; } else { echo 'sorry there error! please try again.'; } } ?>
Comments
Post a Comment