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
Andres Velasquez
19,671 PointsContact Form Help
Hello everyone!
I'm working on a contact form on the home page of this website: http://www.ajvelasquez.com/easymailing_lists/ based on the "Adding a Contact Form" PHP course; however, when the form is completed and sent, the "Thank You" message breaks the rotator at the top of the site and also displays the message that was sent.
I'm guessing that the reason this happens is because of the CSS framework that I'm using, since I have the the "Thank You" messaged echoed out once the form is sent, and the form disappears and its replaced with the Thank you message so it breaks the framework.
I just don't know enough PHP to be able to fix this. So if anyone can help me out I would really appreciate it!!
1 Answer
nik
8,925 PointsIf it's breaking your css have the page redirect to a specified thank you page as shown in the end of the "redirecting after a form submission" video. Your header and footer should stay intact since the body is the only thing that's changing.
Andres Velasquez
19,671 PointsAndres Velasquez
19,671 PointsNick thank you for your answer! I don't want to redirect to a thank you page. I would like to keep the visitor on the home page.
nik
8,925 Pointsnik
8,925 PointsNo problem, in that case how bout adding a div block that has a "thank you" message in your homepage. Set that div to have conditionals that would show only if the form is submitted and hidden if not. That way you can see if that div breaks your css even before adding the conditionals.
Faizal Heesyam
8,843 PointsFaizal Heesyam
8,843 Pointsagree with +Nick E. on this one.
usually i just do a simple if..else for this kind of single-page processing script..