Thread: html text boxes

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    127

    html text boxes

    One thing that has always bugged me. How exactly do text boxes on websites get the information typed in back to the server without the use of scripts? It that even possible?

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    Scripts can be used, but they are at the server.

    The submit button, or a submit event (Javascript), in HTML. The browser is doing it. It runs with a GET or POST request to a (usually) CGI script or program at the server.
    Mainframe assembler programmer by trade. C coder when I can.

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    127
    So what your saying is the browser sends the data back in a packet regardless of whether or not you use script?

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Yes. Forms are older than script.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Registered User
    Join Date
    Jun 2008
    Posts
    127
    Okay. I just have one last question. I was reading an HTML tutorial on W3 and they said that when the submit button is pressed, a file is sent back to the server containing the input. They show that the file is sent back with the extension .asp. Is this so the server will treat them as an ASP script file? And if you're not using a script, what extension would you use?

  6. #6
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    "asp" stands for Active Server Pages. And, that's not how it works. ASP is one framework for web sites to use. Another is .jsp, Java Server Pages. And, there are others.

    It's not a file, per se, that is sent with a submit button, but "form data", which is just a bunch of parms passed back to the server. A "buffer", if you will.

    A file would only be sent back if you were prompted to upload a file (and again, ir would not necessarily have an ".asp" extension. A web site serving up a page to a visitor would have an extension of .asp, if and only if they were using the ASP framework.
    Mainframe assembler programmer by trade. C coder when I can.

  7. #7
    Registered User
    Join Date
    Jun 2008
    Posts
    127
    I get it a little bit more now. I misread this line from W3 schools:

    When the user clicks on the "Submit" button, the content of the form is sent to the server. The form's action attribute defines the name of the file to send the content to. The file defined in the action attribute usually does something with the received input.

    I thought the second sentence meant that a physical file containing the form was sent, but the form data was sent to a file.

  8. #8
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    And that's still incorrect, because an URL doesn't have to correspond to a file. On the HTTP level, the server receives something like this from the client:

    Code:
    POST url-from-action HTTP/1.1
    Host: host-from-action
    ...
    form data follows here
    How the server interprets it is really completely up to the server.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  9. #9
    Registered User
    Join Date
    Jun 2008
    Posts
    127
    Wow I'm lost. I'd hate to ask anymore nonsense questions so is there any kind of tutorial or book that would teach something like this?

  10. #10
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    When I started learning about CGI scripts is when it clicked for me. CGI scripts (and other things like them), more or less, tie the user and the web server together.

    Hunt for terms CGI, GET and POST. There are other ways than "forms" to interact with a server, but once you get forms, the rest will follow (in concept if nothing else).
    Mainframe assembler programmer by trade. C coder when I can.

  11. #11
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Hum ... something on networking, I guess. "Distributed Systems" by Tanenbaum provides a compact but very decent introduction to how the web works, but it's really a book about distributed systems, so it looks at the larger image and specific problems, not specific technologies. Most server-side scripting books (on PHP, JSP, ASP, Ruby on Rails, and so on) give introductions to how the web works, too.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  12. #12
    Registered User
    Join Date
    Jun 2008
    Posts
    127
    Thanks for all your help you guys.

  13. #13
    chococoder
    Join Date
    Nov 2004
    Posts
    515
    The form data is sent as part of the http request, simply as a series of strings of text (possibly encrypted or encoded in some form, for example when you use https instead of http) as key-value pairs.
    Depending on whether you're using a post or get request, that data is sent as part of the URL (get request, generating URL parameters like the t=109979 for this thread) or encoded into the request headers (post request).
    No file is generated anywhere (though the server could in theory cache the request until it can be processed if it's very busy, which could result in a temp-file somewhere, but that's not part of the request-response cycle but rather an implementation detail).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. List Boxes and Text Files
    By Daniel in forum Windows Programming
    Replies: 2
    Last Post: 07-02-2003, 04:16 PM
  2. Replies: 1
    Last Post: 07-13-2002, 05:45 PM
  3. Ok, Structs, I need help I am not familiar with them
    By incognito in forum C++ Programming
    Replies: 7
    Last Post: 06-29-2002, 09:45 PM
  4. Problem with static text in dialog boxes
    By Clyde in forum Windows Programming
    Replies: 11
    Last Post: 05-28-2002, 12:51 PM
  5. Text Boxes
    By gnu-ehacks in forum Windows Programming
    Replies: 1
    Last Post: 11-22-2001, 02:37 PM