Error in creating contact form with php -
i created simple contact form follows.
<form method="post" action="mail_receive.php"> <label>name *</label> <input name="name" placeholder="type here"> <label>email *</label> <input name="email" type="email" placeholder="type here"> <label>phone no *</label> <input name="phone" placeholder="type here"> <input id="submit" name="submit" type="submit" value="">
and php file called mail_receive.php
<?php $name = $_post['name']; $email = $_post['email']; $phone = $_post['phone']; $from = 'from: someone'; $to = 'admin@gmail.com'; $subject = 'ticket ordering'; $body = "from: $name\n e-mail: $email\n phone:\n $phone"; if (isset($_post['submit'])) { if ($name != '' && $email != '' && $phone != '') { if (mail ($to, $subject, $body, $from)) { echo '<p>your message has been sent!</p>'; } else { echo '<p>something went wrong, go , try again!</p>'; } } else { echo '<p>please fill required fields !!</p>'; } }?> }
and uploaded hosting. although can fill form , submit, can't receive email inbox. there wrong?
with mail, it's meant
mail($to, $subject, $message, $headers);
try this:
$to = "youremailaddress@whatever.com"; $subject = "your tickets yo"; $headers = "from: someone@someone.com\r\n"; $headers .= "reply-to: someone@someone.com\r\n"; $headers .= "mime=version:1.0\r\n"; $headers .= "content-type: text/plain; charset=utf-8\r\n;" $message = "nice tickets bro."; mail($to, $subject, $message, $headers);
and please hope it's example purposes, please don't sending admin@gmail.com
because (unless admin@gmail.com
, wont recieve e-mail.
Comments
Post a Comment