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
davidreyes2
3,422 PointsWhere does the input go from the form?
<html lang="en-us">
<head>
<meta charset="utf-8">
<title> Input</title>
</head>
<body>
<h1 class="logo">Input</h1>
<label>Input</label>
<form action="">
Business Name: <input type="text" name="BusName"><br>
</form>
<form action="">
Name: <input type="text" name="Name"><br>
</form>
<form action="">
Position: <input type="text" name="BusName"><br>
</form>
<form action="">
Phone Number: <input type="text" name="BusName"><br>
</form>
</body>
</html>
I want to input words into the form, but idk where the words go after that.
Does it go to a database?
What programming code is used to extract those words from the database to post into a new page on a website that is set up in a format that was created with html and css?
I hope this question makes sense.
Thanks!
Kevin Korte
28,149 PointsWhat do you mean a new page? Like when you submit a form, it takes you to a "thank you" page or something of that sort?
davidreyes2
3,422 PointsFor example Inputing business name and submitting it. After submitting it, I want it to be posted on a webpage. And if I submit another business name, I want it posted in a new page. Kind of like an unlimited supply of pages created every time I submit it.
Kevin Korte
28,149 PointsSo after a form submit with a business name, you'd create a URL like mydomain.com/businessname or businessname.mydomain.com?
davidreyes2
3,422 PointsIs there a way to auto generate the website name? The way you explained it seems to me that I would have to do it manually for every form?
Kevin Korte
28,149 PointsSorry I'm not following, auto generate what website name? Would each business name submittited get it's own website, like businessname1.com, businessname2.com and so on, or would they be a part of your website?
davidreyes2
3,422 PointsPart of the website like website.com/business1 website.com/business2 website.com/business3 website.com/business4 Etc......
Kevin Korte
28,149 PointsYes, that can be generated automatically. Any social media site does essentially this. Even at treehouse, my account is https://teamtreehouse.com/kevinkorte. I can promise you someone is not manually creating pages.
Here is what you'll need to go learn. You need to learn about MVC (model-view-controller) frameworks, and routing.
Websites of scale do not create files for each entry like this. I can promise that there is not a kevinkorte file on treehouse. There is a student profile file though. And when you go to a url like https://teamtreehouse.com/kevinkorte, the controller grabs the router sends request to a specific controller, the controller grabs the information and sends it off to the model, the model request from the database information about kevinkorte. The database looks up my account stats, passes it back to the model, the model may or may not modify this information, which passes it back to the controller, which may or may not modify this information itself, which finally passes this information to the view, which is what gets displayed to your screen, showing my point total, badges, name, etc.
The beautful part about this set up for a website, is down the road you want to change the look, add or remove something, or make any other changes, it doesn't matter if you have 5 or 5,000 entries, you only have one spot to make these changes, and all of the accounts will get the update/change.
Every website that does what you're wanting to do will have some sort of structure that follows this.
What I just said probably was a lot, so you'll want to start learning. You could go learn Python with Flask or Django, Ruby with Rails, PHP with Laravel, or even Node.js. Treehouse has courses on all of this, and you'll be taught exactly how to do what I just mentioned. It will probably take you 3-6 months, but I promise you that you do not want to be generating a new file for each business, the website will at some point become un-maintainable, seriously.
But as I hopefully mentioned, the short answer is yes what you want to do can be automated.
2 Answers
Kevin Korte
28,149 PointsThe forms action dictates where the form data goes. Right now, there is no action those forms, so the data would be submitted back to the same file it came from. That's where you'd use some server side language to get the form data, and do something with it. You can do whatever you want with the info. You could show it back to the user, email it, save it in a database, whatever you want. You'll learn about how to work with getting data from forms in future lessons here.
roxannecarlson
8,131 PointsThe code you provided is just a sample to show how forms look when they are presented to a user. To actually put the data to use, there is more code allowing storage of the data to a server and then retrieval of the data from the server. There are several ways to accomplish this and some will require some knowledge of PHP, or possibly, JavaScript, etc. HTML and CSS are about presentation/appearance of a web page.
davidreyes2
3,422 Pointsdavidreyes2
3,422 PointsHow is a new page created each time the form is submitted?
Thanks for the earlier answers!