| |
![]() | ![]() |
![]() By Alan Flum of Celestial Graphics Inc. | Links To This
Guide: Introduction | More
Text Tags | Text Color and Size | Adding
Links | Images | Table
Basics | Great
Looking Pages | Forms | Going
Further | |
| ||
|
So far,
you have learned how to create web pages using HTML that have a nice
look and feel. These pages are basically static and unchanging. One
of the key reasons why the web is both interesting and useful is that
it can be dynamic and responsive to the user. |
|
What
Does it Mean To Have A Dynamic Web Page? A dynamic web page responded to input from the customer. As an example, fill out the form below and click enter. Lets see how this works. Below is the HTML for the form:
Lets look at the HTML line by line: <form method="post" action+"html-tutorial-simple-form.php3> This this the opening tag of the <form></form> tag set. It has two attributes method and action. The "Action" attribute tells your browser what action you want the form to take. Usually this means calling a computer program or script that acts on the information or "data" that you entered into the form. In this case, it calls a script called html-tutorial-simple-form.php3. Will look at this in more detail in a little bit. The "method" action tells your browser how it should send the data inside the form. There are two methods: Get and Post. Get adds the data to the URL. For example, lets say you entered the name Jane in the form above. If the form used method="get", the URL that you would see in your browser would change from html-tutorial-simple-form.php3 to html-tutorial-simple-form.php3?name=Jane . "Get" simply added your input, in this case, Jane. "name" is the name of the text box where you filled in the information and the ? separates the data from the URL. The "Post" method also sends the data to script that is called by the form. It does not embed the data in the URL like post. It sends it in a way where the information remains hidden. <b>What is Your Name?</b><br> This of course is just standard HTML markup. <b></b> makes the text contained inside it, What is Your Name?, bold. The <br> creates a new line. <input type="text" name="name" size="20" maxlength="20"> This line creates the text entry box that you see inside the form. Notice that the <input> tag has the attributes type, name and the optional attributes size and maxlength. Type="textbox" tells us that the form input is a box where the user can enter text. Name="name" tells us that information you type inside the text box will be assigned the name, name. If the form had said Name="user-info", then the information would have been assigned the name, user-info. Size="20" and maxlength="20" indicate the size of the text box in characters and the maximum number of characters you are allowed to enter into the text box respectively. <input type="submit" name="Submit" value="Enter"> Finally, this line creates the button at the bottom of the form. Type="submit" indicates that this is a standard HTML submit button. The name indicates the name of the button that will be passed to the script. This is useful if there is more than one button. For example, you could have one button with name="accept" and another with the name="decline". The script would process the user data differently based on whatever button was pressed. Value="Enter" is simple the name that appears on the button. If we the form contained value+"go" the the button would have said go. Next, we will look at exactly how the form gets processed. |
|
Copyright
© by Acquired Knowledge Systems Inc.
Website Design by Celestial Graphics Privacy Policy | Site Security | Terms of Use | Contact and Internet Access Info | | About Us | Give Us Your Feedback | |