Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP

About contact.php

Hello I am working on my portfolio web and i am adding simple form in the footer. I also watched PHP class Shirts4Mike. I can give action="contact.php" , so i will have contact .php that will send my form. I can not check it since local host only work with php file. Is there any other way that i can check that? Also i want show that form submitted successfully with little pop up message. Do i use Java Script or php? Which video will give me more info on that? Thank you

4 Answers

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

You need to test that the production server will send the email. If you are using the web server itself to send the email, then you'll have to upload the files to the server to see if it will work. If instead you are using an external mail server with SMTP, you could set that up in your local environment. (Check out my blog post on that: Sending Email With PHPMailer and SMTP.)

We have a few different tutorials that deal with contact forms:

jQuery

PHP

What kind of "pop up" do you want? Can you describe the flow you want step by step? Something like this:

  1. A site visitor clicks the Contact link. The form loads in the browser.
  2. The visitor fills in three pieces of information: name, email, and message.
  3. {Then what happens?}

My web portfolio is only one page site.So everything is in one page including form. The form is asks for name, email, and message.

  1. after submit button i want page stay as is
  2. and pop up comes in and says "your message sent successfully, click ok to back to top " or something like that

I'll check out your suggestions Thanks bunch

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

You will need to use Ajax for this, which requires a JavaScript component and a server-side component:

  1. You'll need a PHP service that can receive and process an Ajax request.
  2. You'll need JavaScript code that sends the request to the PHP service.

I'll be covering all this in my next PHP later this year.

Wow its lot complicated ok i find another way to do it.. Thank you