php - form to mail script not sending data -
i have simple form 3 fields, contact_name contact_email & contact_message when submit this, data entered form not emailed me. if check being posted can see array posted:
array ( [contact_name] => paul [contact_email] => test@test.com [contact_message] => d;lkf'dskf;lsdkf )
here form code:
<form role="form" name="form1" action="send_form_email.php" method="post"> <div class="row"> <div class="form-group col-xs-12 floating-label-form-group"> <label for="name">name</label> <input class="form-control" type="text" name="contact_name" placeholder="name" id="contact_name"> </div> </div> <div class="row"> <div class="form-group col-xs-12 floating-label-form-group"> <label for="email">email address</label> <input class="form-control" type="email" name="contact_email" placeholder="email address" id="contact_email"> </div> </div> <div class="row"> <div class="form-group col-xs-12 floating-label-form-group"> <label for="message">message</label> <textarea name="contact_message" placeholder="message" class="form-control" rows="5" id="contact_message"></textarea> </div> </div> <br> <div class="row"> <div class="form-group col-xs-12"> <button type="submit" class="btn btn-lg btn-success">send</button> </div> </div> </form>
and here php script:
<?php // contact subject $subject ='message leeds computers'; // details $message="$contact_message"; // mail of sender $mail_from="$contact_email"; // $header="from: $contact_name <$mail_from>"; // enter email address $to ='test@gmail.com'; $send_contact=mail($to,$subject,$message,$header); // check, if message sent email // display message "we've recived information" if($send_contact){ echo "we've received contact information"; } else { echo "error"; } ?> <? echo '<pre>'; print_r($_post); echo '</pre>'; ?>
any appreciated
you have modify @ post:
// details $message=$_post["contact_message"]; // mail of sender $mail_from=$_post["contact_email"]; // $header="from: " . $_post["contact_name"] . " <$mail_from>";
Comments
Post a Comment