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

Laura Cressman
Laura Cressman
12,548 Points

Form Elements: Where does the data go?

Hi everyone, I realize that when we code out form elements in the earlier courses, we don't really talk about what attributes to add within the HTML tags. Specifically, what happens when someone clicks submit? Where does the form data go? How can someone else later access that data, say from a contact form? Perhaps there is a course on this, and I just haven't gotten to it yet. If you would like to shed any light on this topic, I would greatly appreciate it. Happy Sunday, Laura:)

3 Answers

Torger Angeltveit
Torger Angeltveit
11,228 Points

Hi :) i im a newbie myself but i have some experience with Forms in html, For the data to be functional you need to add some PHP code, so when someone press the submit button the form will be sent to a PHP file and the php code reads the html form and saves the data in a database through Mysql. There is probably many other ways to do it, but i think this is a great way to start. Good luck, and i hoped it helped abit :)

Laura Cressman
Laura Cressman
12,548 Points

Thanks Torger! If I use PHP (I've also heard Python and other languages work), how would I later access this database?

Also JAVA, ASP.NET, Ruby (there's a Ruby track here on treehouse) and even javascript are used for server-side programming. Lately they emailed that they have new teachers for Java and Python (Although a Java track may be focused on Android and not on server-side).

Laura Cressman
Laura Cressman
12,548 Points

Thanks-I feel as though I know enough Javascript and Python to write basic programs, but what I struggle with is understanding how to get these languages to interact with the HTML and the server.

To be honest, I am very curious about how Python does it. If a Python track will come out soon I'll probably go through it. Until than it is possible to find tutorials on several sources, But if you know php than it shouldn't be very different under the hood.

Laura Cressman
Laura Cressman
12,548 Points

Looking forward to checking out the web to see what I can find:)

No problem Laura. You can say that server is the same as web hosting, yes. To be more accurate, a web host maintains several web servers and database servers and provides it's customers with a root directory, some storage, the right to create some databases etc. So It would be more accurate to say that most people don't maintain their own server (a server is a machine, hardware and software after all) but acquire the services of a web hosting company that does it for them.

Here on treehouse they have an HTML deep-dive with a forms aceivement: http://teamtreehouse.com/library/html Besides that you can find information on plenty of websites, just search for "html forms". Try this site for a complete reference: http://www.w3schools.com/html/html_forms.asp I recommend working through the php track here on treehouse to learn about server-side development or what happens to those parameters on the server: http://teamtreehouse.com/tracks/php-development

Laura Cressman
Laura Cressman
12,548 Points

Thanks Zack, Could you explain the difference between web servers? As for the HTML deep dives, I've actually done them all, so making form elements appear on a web page makes sense to me. It's just knowing what to do with them on the server side that I'm struggling with. I will definitely check out the PHP track though! Thanks for the advice:)

What do you mean by the difference between web servers? can you be a little bit more specific?

Laura Cressman
Laura Cressman
12,548 Points

I was just referring to your comment that: "To be more accurate, a web host maintains several web servers and database servers...", and asking if there was a difference between web and database servers, and if so, what is it?

I see. By "web server" I mean a server that is programmed to serve websites. It is also called an HTTP server because web sites are served over the HTTP protocol. You may have heard of the Apache HTTP server, well most web hosts provide you with an Apache-based web server. Another popular option is IIS - a web server developed by Microsoft or others. A database server is a server running a database software such as MySQL or MSSQL and provides network access to manage databases. Sometimes the HTTP software and the database software are running together on the same server, such as the case with the Mamp, Wamp, Xampp and Lamp software packages where a.m.p stands for Apache, MySQL, PHP.

Hi Laura. When a user clicks the submit button, an http request is sent to an http server. The type of the request and it's parameters and content are determined by the various form elements (every name attribute becomes a parameter in the query string) and the address of the server is set by the target attribute of the form.

Laura Cressman
Laura Cressman
12,548 Points

Thanks so much Zack! Do you know, or have a link to, the different options for form elements that vary the request? Also, is the server the same as web hosting? I am new to this, so please bear with me:)