![]() The value attribute of each element contains a bit of Razor code (for example, Request.Form). It's helpful to use meaningful names that help you remember what data you're working with. As you saw in the previous tutorial, these names are important because you must have those names so you can get the user's input later. Note that each text box has a name element ( title, genre, year). (For more about the difference between GET and POST operations, see the GET, POST, and HTTP Verb Safety sidebar in the previous tutorial.) Therefore, this form should use the post method. However, in this page you will make changes-you're going to add new database records. All it did was fetch data in different ways. That was correct, because although the form submitted values to the server, the request did not make any changes. In the previous tutorial, you created a form that used the get method. Notice that in this page, the element uses post as the value for the method attribute. The and elements put a nice box around the form. ![]() The captions for the text boxes are created by using standard elements. It uses elements for the text boxes and for the submit button. This example shows typical HTML for creating a form. Overwrite everything you'll add a code block at the top shortly. Replace what's in the file with the following markup. The text boxes will be HTML elements that will look like this markup: The page will contain an entry form that has fields (text boxes) where you can enter a movie title, genre, and year. You'll create a page where you can enter new movies. So in this tutorial, you'll create a web-based interface that lets you or anyone enter data and save it to the database. In most apps, that's not a practical way to put data into the database, though. ![]() In the tutorial earlier that showed you how to create a database, you entered database data by editing the database directly in WebMatrix, working in the Database workspace.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |