2

Im working on my webpage and I would to send an email through a modal. Meaning the user click the email button. The #emailModal shows up with 3 input sections. Email, Subject, and Content. I would like it to send the email to the email address the user enters once the user clicks the send email button.

My question is different because I want to send an email to my clients, so click on a button I enter their email, the subject matter, and the content.

Home.php

<div class="modal fade" id="emailModal" tabindex="-1" role="dialog" aria-labelledby="emailModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="emailModalLabel">Email</h4>
                          </div>
                          <div class="modal-body">
                            <form class="form-horizontal method="post" role="form" action="send_email_form.php"">
                            <fieldset>

                            <!-- Form Name -->
                            <legend>Email</legend>

                            <!-- Text input-->
                            <div class="form-group">
                              <label class="col-md-4 control-label" for="email">Email:</label>  
                              <div class="col-md-5">
                              <input id="email" name="email" type="text" placeholder="placeholder@gmail.com" class="form-control input-md" required="">

                              </div>
                            </div>

                            <!-- Text input-->
                            <div class="form-group">
                              <label class="col-md-4 control-label" for="subject">Subject:</label>  
                              <div class="col-md-5">
                              <input id="subject" name="subject" type="text" placeholder="" class="form-control input-md">

                              </div>
                            </div>

                            <!-- Textarea -->
                            <div class="form-group">
                              <label class="col-md-4 control-label" for="content">Content:</label>
                              <div class="col-md-4">                     
                                <textarea class="form-control" id="content" name="content"></textarea>
                              </div>
                            </div>

                            </fieldset>
                            </form>

                          </div>
                          <div class="modal-footer">
                            <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
                            <button type="button" class="btn btn-primary">Send Email</button>
                          </div>
                        </div>
                      </div>
                    </div>

send_email_form.php

 $to = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['content'];

$headers = "From: info@demo.com".phpversion();

<?php 
mail($to, $subject, $message, $headers);
?>

here is my php file, when i click the submit button nothing is appearing to happen. I know my php is basic, im just looking for something very simple and to the point.

Charles L.
  • 1,844
  • 2
  • 34
  • 56

0 Answers0