Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

bootstrap template contact form not working

Hi can someone please help me with this contact forms code. I am not receiving the emails,

<div class="col-md-7 contact-form wow animated fadeInLeft">
                        <form action="mailto:crewesandy@sandracreweservices.co.za" method="post">
                            <div class="input-field">
                                <input type="text" name="name" class="form-control" placeholder="Your Name...">
                            </div>
                            <div class="input-field">
                                <input type="email" name="email" class="form-control" placeholder="Your Email...">
                            </div>
                            <div class="input-field">
                                <input type="text" name="subject" class="form-control" placeholder="Subject...">
                            </div>
                            <div class="input-field">
                                <textarea name="message" class="form-control" placeholder="Messages..."></textarea>
                            </div>
                            <button type="submit" id="submit" class="btn btn-blue btn-effect">Send</button>
                        </form>
                    </div>

2 Answers

Hi Bianca,

Although bootstrap sets up the form, it still requires the contact.php to be set up so you can retrieve the form data and sent the email :)

Bootstrap is just handling the styles and front end functions.

This is one of the first articles I read on contact forms it may be helpful, if not let me know and i will get the form going with you :)

Craig

Hi Craig. Thanks for the answer. I read through the link you sent. I was not sure what to put in by the form action =. I am not familiar with php. I read through other articles and they all put example.php and no email address. So how would I read their message after they press send? Sorry if that is a dumb question. When I check the code in Google it doesn't show up any errors. The website is www.sandracreweservices.co.za. Do you have any advice where they would put the php code in the bootstrap template? Really getting stressed because I can't get it working

Hi Bianca,

Sorry for the delay in getting back to you, PHP is just the server side language we use to process the form data and send the email.

example.php and contact.php are no more than different names for the file containing the php code that processes the form data. You "action" attribute in the form element specifies where the form should look to follow the method of post and then execute the code in that particular file.

I have set up a workspace with your code and added a contact.php with the relevant code in it.

Take a look at the snapshot here

Very nice looking site by the way! love the simple but effective animation not over the top just draws the eye in well!

You will need to push this php file up to the server along with adding the attribute -- name="submit" to the submit button in your html.

Any trouble with it let me know :)

Hi thank you so much, I really appreciate it. I will try it when I get home from work.

Hi Craig, I did everything that you said but it's still not working for some reason. I'm really not sure why because everything looks the same as your code. Sorry for bothering you

I refreshed my servers page and it works now really appreciate it! Thanks for the compliment but it was mostly bootstrap. Thanks again

Hi Bianca,

Glad you got it working :), did you have to modify my code at all to make it work or did it do the trick ?

Craig

Hi Craig, after looking at examples the only thing I put in by the button was value= "submit". I'm not sure if that helped because I wasn't refreshing my browser after editing the code on my server. Thanks again