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

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