Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Introducing forms: part 2

From: XHTML and HTML Essential Training

Video: Introducing forms: part 2

Before we finish up with this subject, I just want to talk a little bit about what happens when you press Send. Now, in this case you'll see that it's set to Action equals and this URL here. This URL here is a test script on my server, bw.org is my server, and this is a test script that's available on my server. Go ahead and feel free to use this for testing your forms. It doesn't really use up a lot of resources on my server. So as long as I'm able to provide that, I will. When we press Send here, let's go ahead and fill some stuff and you can see what happens.

Introducing forms: part 2

Before we finish up with this subject, I just want to talk a little bit about what happens when you press Send. Now, in this case you'll see that it's set to Action equals and this URL here. This URL here is a test script on my server, bw.org is my server, and this is a test script that's available on my server. Go ahead and feel free to use this for testing your forms. It doesn't really use up a lot of resources on my server. So as long as I'm able to provide that, I will. When we press Send here, let's go ahead and fill some stuff and you can see what happens.

I am that, and I am that, and I am that. And let's see here, Other, something else here, and "I don't really have any comments to write, so I won't write anything." There. When I press Send, it's going to send all of this data in the special CGI format to that text script on my server and the text script on my server, all it does is it takes the data that it receives and it displays it on the screen.

So go ahead and press Send and there we have it. It displays that on the screen, and here it is under CGI Values and here is all the stuff that it got in the CGI. We can see that all the data is there from the different widgets that I pressed, and didn't press, and all the text that I wrote in the various text boxes and it's displayed in alphabetical order, because that's just what this particular program does and how it works. So the Name field has my name, Email field has my email. These labels here on the left, these are taken from the Name attributes.

So in the Name field, the Name attribute says Name, and in the Email field, the Email attributes say Email. Next, we have the Radio buttons. Let's take a look at the Radio buttons in the XHTML and those are named Retail, and remember only one of those can be selected at a time. So one of these says Retail and it says Consumer. So the value from the Consumer one gets sent in the Retail variable and the value from the Store one would have got sent if I selected the Store Radio button.

But only one of these will show up with the name Retail. So that's there. Then we have these other variable check boxes, Enthusiast, ProArtist, Hobbyist, HendrixFan, and I think I have selected three of those. I did not select Enthusiast. So we didn't get one for Enthusiast, but we've got HendrixFan on, Hobbyist on, and ProArtist on. Then the Other field which is named Other. So we'll see that here under Other. Something else here. That's what I typed.

Finally, the message field. That's our text area. You'll see it says the Name = Message, and that's what I typed in there. I said I really don't have any comments to write, so I won't write anything. Finally, we clicked on the graphic and you'll notice that the graphic here gave us the Submit variable, but it gave us two of them. One of them says .x and one of them says .y and this is the standard way that Graphic Submit buttons work. It's actually giving us the coordinates on the graphic where I clicked the mouse. So this can be useful in some situations.

It's very rarely actually used. Very few people actually use it or have an application for that. But you can see that it's possible to have one and there are interesting things that can be done, like for instance you could have a map and want to know where somebody clicks on a map and that would be a really easy way to do that. So those are the different variables and how they work. Now, up here in the Form tag, you'll notice that we have this Attribute Method = Post. I said I'd get back to that and tell you what that means. I'm going to change this to the other possibility, which is Method = Get, and this will give you an example of what it does and it will show you how this actually works.

So I'm going to go down here and show you what it means. Now, I'm going to press the back arrow on the browser and I'm back in the form and I have all this data in it. If I just select Reload, it will reload the HTML. Oh! I didn't save it though. So I need to save that up here, there we go. That's saved now. And I'll select Reload and leave all my data in there, but it will reload the form and so when I click on Send, it will use the Get method instead the Post method and that's the Get method. So what the Get method does is it passes all of this CGI information, it passes it in the URL.

So the results of my form are all up here in the URL. See that? Name = Bill Weinman, Email = ww@internet.com, etcetera. All that is in the URL. What this does is it allows the user to actually bookmark these results. So you can hit your Bookmark button and get back to this page with those results already submitted to the CGI program. So that can be useful if you're using CGI for navigation on a site and you want to be able to bookmark certain pages that you've got into by pressing a button.

Most of the time though, you're going to want to use the Post method, and the Post method works like this. Type post up here, and click Save, and I'll go back to my form and I'll click Reload. That leaves the data in here. I'm not actually resetting the form. I would have to put my mouse up here and press Enter to reset the form. So we'll just hit Reload and click Send and now it's using the Post method. You'll see that there is no data up in the URL. The way the Post method works, it's kind of like an email message.

It's not exactly an email message. It sent directly from the browser to the server, but it gives all that data in the body, rather than in the address. The Get method gives it actually in the URL, actually in the address. So all that data is provided. That program works exactly the same and all this data is still available as CGI, but it's just not there in the URL, and so you can't bookmark the data. You can only bookmark the location of the CGI. So most of the time, you are going to prefer to use the Post method. Now, the Action. This is where you put the URL of the CGI program on the server.

CGI script, they are sometimes called. It's actually a program and it's usually written in a scripting language like Perl or PHP or something like that. And that's the server side of it, and so on the front end as opposed to the back end, you need to just specify where that is so that you know where you're sending your data. So that is forms in a nutshell. That is the different elements of the form. You have the text elements, you have the graphic box, and the radio buttons and buttons. This is what the Method means and the Action means.

So this is a good overview of how forms work and ought to be enough for you to be able to design some forms and again while you're designing your forms, if you would like to go ahead and put this in the Action, you're welcome to do that to test your forms using this very little script on my server that doesn't take up much resources. Then when you're actually ready to put your form into action and to use your form for a specific purpose, you'll need a script on the back end that does the CGI, that either sends an email or does whatever it is that you want to be done with your form and so you need to have somebody with some programming skills who is capable of doing that.

I do have another course on lynda.com that explains the process of installing a script that's already written on a server and like I said, this process is very different for different servers and so I can't cover all of the different possibilities in the course. But it gives you some good guidance for how to do that if you want to check it out. It's using Perl with CGI and it talks about how to do that with Perl scripts, and so that is forms and that's how they work.

Show transcript

This video is part of

Image for XHTML and HTML Essential Training
XHTML and HTML Essential Training

59 video lessons · 81410 viewers

Bill Weinman
Author

 
Expand all | Collapse all
  1. 5m 10s
    1. Welcome
      1m 16s
    2. Using the exercise files
      1m 23s
    3. Choosing a text editor
      2m 31s
  2. 15m 46s
    1. Introducing HTML and XHTML
      2m 53s
    2. Understanding versions of HTML and XHTML
      2m 25s
    3. Exploring a simple XHTML page
      4m 47s
    4. Understanding the structure of an XHTML document
      2m 58s
    5. Understanding document containers
      54s
    6. Creating and using templates
      1m 49s
  3. 42m 4s
    1. Understanding how empty space is formatted in XHTML
      2m 42s
    2. Using paragraph tags
      2m 42s
    3. Aligning paragraphs
      2m 49s
    4. Understanding block-level and inline tags
      1m 24s
    5. Controlling line breaks and spaces
      5m 43s
    6. Formatting text with phrase element tags
      3m 28s
    7. Formatting text with font markup elements
      3m 24s
    8. Adding document structure with headings
      3m 25s
    9. Formatting quotations and quote marks
      2m 19s
    10. Preserving pre-formatted text
      1m 30s
    11. Selecting a typeface
      4m 33s
    12. Selecting a type size
      2m 11s
    13. Using ordered and unordered lists
      5m 54s
  4. 7m 48s
    1. Using inline images
      3m 17s
    2. Flowing text around an image
      2m 4s
    3. Breaking lines around an image
      2m 27s
  5. 22m 34s
    1. Working with hyperlinks
      7m 46s
    2. Using relative URLs
      3m 5s
    3. Specifying a base URL
      2m 4s
    4. Linking within a page using fragments
      4m 28s
    5. Creating image links
      5m 11s
  6. 22m 56s
    1. Introducing tables
      4m 37s
    2. Formatting tables with CSS
      8m 50s
    3. Aligning images with tables
      5m 7s
    4. Reviewing an alternative solution using CSS
      4m 22s
  7. 14m 31s
    1. Introducing frames
      7m 56s
    2. Hiding frame borders
      3m 15s
    3. Creating inline frames using iFrame
      3m 20s
  8. 20m 50s
    1. Introducing forms: part 1
      10m 37s
    2. Introducing forms: part 2
      7m 45s
    3. Using CGI with forms
      2m 28s
  9. 25m 42s
    1. Introducing CSS
      3m 11s
    2. Understanding levels of inheritance
      6m 10s
    3. Learning CSS syntax
      11m 23s
    4. Using units of measure in CSS
      4m 58s
  10. 1h 45m
    1. Comparing table layout and CSS layout
      1m 25s
    2. Exploring the finished web site
      2m 37s
    3. Building a document header
      8m 18s
    4. Placing a banner and a contact button
      8m 13s
    5. Laying out a main menu
      6m 55s
    6. Creating a layout template: main body area
      13m 31s
    7. Creating a layout template: sidebar area
      5m 17s
    8. Creating a layout template: footer content
      4m 46s
    9. Building a main home page: main body content
      11m 24s
    10. Building a main home page: sidebar content
      8m 52s
    11. Creating a page with a menu, graphics, and formatted links
      13m 26s
    12. Creating a page containing an ordered list
      6m 44s
    13. Creating a page containing video
      10m 45s
    14. Touring the finished site
      3m 45s
  11. 53s
    1. Goodbye
      53s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed XHTML and HTML Essential Training.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.