Template comes with ready to use:
- Contact Form
- Newsletter Form
All needed files are in /form directory.
Remember to includeon page.
To configure form just edit form/form.php and change e-mails to your own :
1 2 |
$to = "mail@example.com"; $from = "mail@example.com"; |
That’s it!
Contact Form
HTML MARKUP:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<form class="simpleForm" action="form/form.php" method="post"> <fieldset> <div class="form-group"> <label>Your name</label> <input type="text" class="form-control" name="field_[]" placeholder="enter your name"> </div> <div class="form-group"> <label>E-mail address</label> <input type="email" required class="form-control" name="email" placeholder="enter your e-mail address"> </div> <div class="form-group"> <label>Your message</label> <textarea class="form-control" rows="5" name="field_[]" placeholder="type your message"></textarea> </div> <input type="hidden" name="msg_subject" value="Contact Form"> <input type="hidden" name="field_[]" value=" "> <input class="btn btn-default" type="submit" value="Submit"> </fieldset> </form> <div class="successMsg" style="display:none;"> Message has been sent successfully! </div> <div class="errorMsg" style="display:none;"> An error occurred, please try again later. </div> |
— How to add more fields to form ?
Just add another form-group section, for example additional phone and fax :
HTML MARKUP:
1 2 3 4 5 6 7 8 |
<div class="form-group"> <label>Your Phone</label> <input type="text" class="form-control" name="field_[]" placeholder="enter your phone"> </div> <div class="form-group"> <label>Your Fax</label> <input type="text" class="form-control" name="field_[]" placeholder="enter your fax"> </div> |
Newsletter Form
HTML MARKUP:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<form class="newsletterForm simpleForm" action="form/form.php" method="post"> <fieldset> <div class="form-group"> <input class="form-control" type="email" name="email" required placeholder="enter your e-mail address"> </div> <input type="hidden" name="msg_subject" value="New Newsletter subscription"> <input type="hidden" name="field_[]" value=" "> <input class="btn btn-default" type="submit" value="Submit"> </fieldset> </form> <div class="successMsg" style="display:none;"> Your e-mail has been added to our list! </div> <div class="errorMsg" style="display:none;"> Error, please try again later. </div> |
Options (can be changed in HTML) :
- Mail Subject – just change value in : <input type=”hidden” name=”msg_subject” value=”Contact Form”>
- Success Message – change successMsg div content (below form)
- Error Message – change errorMsg div content (below form)