If you like SEOmastering Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...

 

Building an HTML Page with a Form

Started by chinmay.sahoo, 01-14-2016, 04:19:34

Previous topic - Next topic

chinmay.sahooTopic starter

Forms are very useful when you want to get information from the user. To illustrate how this is done, look at the whatsName.html code:

Quote<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>What's your name?</title>
<link rel = "stylesheet"
type = "text/css"
href = "whatsName.css" />
</head><body>
<h1>What's your name?</h1>
<h3>Writing a form for user input</h3>
<form method = "get"
action = "hiUser.php">
<fieldset>
<label>
Please type your name:
</label>
<input type = "text"
name = "userName"
value = "" />
<input type = "submit" />
</fieldset>
</form>
</body>
</html>

If you're familiar with XHTML forms, there is only one element of this page that may not be familiar to you. Take a careful look at the form tag. It contains two new attributes. action is one of those attributes. The other, method, indicates how the data is sent to the browser. get and post are the two primary methods. post is the most powerful and flexible, so it is the one I use most often in this book. However, you see some interesting ways to use get later in this chapter in "Sending Data without a Form." For that reason, I show the get technique first.



If you like SEOmastering Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...