jeudi 27 octobre 2016

Returning POST message is not appearing where it should

I followed this great tutorial on how to build a contact form. Everything works great except the success/error messages, instead of appearing above the fields like they should they appears in a 'separate page' i.e http://ift.tt/2eKO4P9

I copy paste the contact.php and just updated $from & $to values and removed the last name and phone fields from the fields array, tocontact.jsi didn't made any changes. the file that is a bit different is the index.php here is the code index.php:

<!-- contact -->
       <div class="contact wowload fadeIn">
       <div class="container">
       <h2 class="text-center">Contact us</h2>
       <div class="row">
        <div class="col-sm-6 col-sm-offset-3">
          <form id="contact-form" method="post" action="contact.php" role="form">
            <div class="messages"></div>
                <div class="form-group">
                    <input id="name" name="name" type="text" class="form-control" placeholder="name" required="required" data-error="enter your name"> 
                    <div class="help-block with-errors"></div>
                </div>
                <div class="form-group">
                    <input id="email" name="email" type="email" class="form-control" placeholder="email*" required="required">
                    <div class="help-block with-errors"></div>
                </div>
                <div class="form-group">
                    <textarea id="message" name="message" class="form-control" placeholder="message" rows="5" required="required"></textarea>
                    <div class="help-block with-errors"></div>
                </div>   
               <div>
                   <p class="text-muted"><strong>*</strong> These fields are required.</p>
               </div>                
                <button type="submit" class="btn btn-success"><i class="fa fa-send-o"></i> Submit</button>

            </form>

          </div>
        </div>
       </div>
       </div>
       <!-- contact -->

Why the message not appear where it should, Thanks.




Aucun commentaire:

Enregistrer un commentaire