0% found this document useful (0 votes)
91 views17 pages

Web 4 Utpal

The document contains a student's assignment submission for a lecture. It includes the student's declaration that the work is their own and provides their signature. It also contains the student's responses to three questions asking about HTML form attributes and controls. The student designed a feedback form for McDonald's customers using various form controls like text fields, dropdown menus, radio buttons, and textareas. They also provided examples of how to add submit buttons, radio buttons, buttons, pull down menus and pop ups to a web page.

Uploaded by

SONU_KUMAR
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
91 views17 pages

Web 4 Utpal

The document contains a student's assignment submission for a lecture. It includes the student's declaration that the work is their own and provides their signature. It also contains the student's responses to three questions asking about HTML form attributes and controls. The student designed a feedback form for McDonald's customers using various form controls like text fields, dropdown menus, radio buttons, and textareas. They also provided examples of how to add submit buttons, radio buttons, buttons, pull down menus and pop ups to a web page.

Uploaded by

SONU_KUMAR
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 17

SUBMITTED TO:

SUBMITTED BY:

LECT.ANUPAMA SINGH
UTPAL PRATAP SINGH

ROLL NO. RE3804B44

REG. NO. 10806602


Declaration

I declare that this assignment is my individual work. I have


not copied from any other student’s work or from any other
source except where due acknowledgment is made explicitly
in the text, nor has any part been written for me by another
person.

Student’s Signature :

Utpal Pratap Singh


Part-A

Q1. What is the significance of a form & the attributes used in form
tag? Design a feedback form for Mc Donald customers.

ANS:- Forms
A form is an area that can contain form elements.

Form elements are elements that allow the user to enter information (like text
fields, textarea fields, drop-down menus, radio buttons, checkboxes, etc.) in a form.

A form is defined with the <form> tag.

<form>

input elements

</form>

Input

The most used form tag is the <input> tag. The type of input is specified with the type
attribute. The most commonly used input types are explained below.

Text Fields
Text fields are used when you want the user to type letters, numbers, etc. in a form.

<form>

First name:

<input type="text" name="firstname" />

<br />

Last name:

<input type="text" name="lastname" />

</form>

Radio Buttons
Radio Buttons are used when you want the user to select one of a limited number of
choices.

<form>

<input type="radio" name="sex" value="male" /> Male

<br />

<input type="radio" name="sex" value="female" /> Female

</form>

Checkboxes
Checkboxes are used when you want the user to select one or more options of a limited
number of choices.

<form>

I have a bike:

<input type="checkbox" name="vehicle" value="Bike" />

<br />
I have a car:

<input type="checkbox" name="vehicle" value="Car" />

<br />

I have an airplane:

<input type="checkbox" name="vehicle" value="Airplane" />

</form>

The Form's Action Attribute and the Submit Button

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.

<form name="input" action="html_form_submit.asp" method="get">

Username:

<input type="text" name="user" />

<input type="submit" value="Submit" />

</form>

A feedback form for Mc Donald customers

<html>

<body>

<form>

<center> <font size=20>MC Donald Feedback Form For

Customers</center></font><br><br>
Name Of Customer:&nbsp;&nbsp;<input type="Text"

name="Customer"></input><br>

Address of Customer:<input type=”text” name=”Address”></input><br>

Mobile Number:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input

type="Text" name="Contact"></input><br><br>

Select a Country:

<select name= Country>

<option>America</option>

<option>Australia</option>

<option>Canada</option>

<option>England</option>

<option>India</option>

<option>Russia</option>

</select><br><br>

Is MC Donald fulfill Your all Needs<br>

<input type="Radio" name="needs">Yes</input><br>

<input type="Radio" name="needs">No</input><br><br>

Are you satisfy with our service<br>

<input type="Radio" name="satisfy">Yes</input><br>

<input type="Radio" name="satisfy">No</input><br><br>

Any Suggestion About Us : <br>

<textarea name="choose" rows="5" cols="50"></textarea><br><br>

<input type = "Submit" value="Submit"></input>

<input type="Submit" value="Reset"></input></center>

</form>

</table>
</html>

Q2. What are various controls used in forms, enumerate with the help
of example.
ANS:- There are actually three types of text input used on forms:

Single-line text input controls: Used for items that require only one line of user input,
such as search boxes or names. They are created using the <input> element.

Password input controls: Single-line text input that mask the characters a user enters.

Multi-line text input controls: Used when the user is required to give details that may
be longer than a single sentence. Multi-line input controls are created with the
<textarea> element.

Single-line text input controls:


Single-line text input controls are created using an <input> element whose type
attribute has a value of text.

Here is a basic example of a single-line text input used to take first name and last name:

<form action="/cgi-bin/hello_get.cgi" method="get">

First name:

<input type="text" name="first_name" />

<br>

Last name:

<input type="text" name="last_name" />

<input type="submit" value="submit" />

</form>

This will produce following result:

First name

Last name

submit
Following is the list of attributes for <input> tag.

type: Indicates the type of input control you want to create. This element is also used to
create other form controls such as radio buttons and checkboxes.

name: Used to give the name part of the name/value pair that is sent to the server,
representing each form control and the value the user entered.

value: Provides an initial value for the text input control that the user will see when the
form loads.

size: Allows you to specify the width of the text-input control in terms of characters.

maxlength: Allows you to specify the maximum number of characters a user can enter
into the text box.

Password input controls:

This is also a form of single-line text input controls are created using an <input>
element whose type attribute has a value of password.

Here is a basic example of a single-line password input used to take user password:

<form action="/cgi-bin/hello_get.cgi" method="get">

Login :

<input type="text" name="login" />

<br>

Password:

<input type="text" name="password" />

<input type="submit" value="submit" />

</form>

This will produce following result:

Login
Password

submi

Multiple-Line Text Input Controls:


If you want to allow a visitor to your site to enter more than one line of text, you should
create a multiple-line text input control using the <textarea> element.

Here is a basic example of a multi-line text input used to take item description:
<form action="/cgi-bin/hello_get.cgi" method="get">
Description : <br />
<textarea rows="5" cols="50" name="description">
Enter description here...
</textarea>
<input type="submit" value="submit" />
</form>

This will produce following result:

Description :
Enter description here…….

subm
it

Following is the detail of above used attributes for <textarea> tag.

name: The name of the control. This is used in the name/value pair that is sent to the
server.

rows: Indicates the number of rows of text area box.

cols: Indicates the number of columns of text area box.


Q3. How would you add following contents to a web page?

a) Submit button

b) Radio button

c) Button

d) Pull down menus

e) Pop ups

ANS:-

a) submit: This creates a button that automatically submits a form.

Here is the example:

<form action="http://www.example.com/test.asp"
method="get">

<input type="submit" name="Submit" value="Submit" />

</form>

b) Radio button:-

Radio Buttons are used when only one option is required to be


selected. They are created using <input> tag as shown below:

Here is example HTML code for a form with two radio button:

<form action="/cgi-bin/radiobutton.cgi"
method="post">
<input type="radio" name="subject" value="maths" />
Maths

<input type="radio" name="subject" value="physics" />


Physics

<input type="submit" value="Select Subject" />

</form>

Here is example HTML code for a form with two radio button

Maths Select
physics
subject

Following is the list of important radiobox attributes:

type: Indicates that you want to create a radiobox.

name: Name of the control.

value: Used to indicate the value that will be sent to the server if this option is
selected.

checked: Indicates that this option should be selected by default when the page
loads

c) button: This creates a button that is used to trigger a client-side script when
the user clicks that button.

Here is the example:

<form action="http://www.example.com/test.asp"
method="get">

<input type="button" value="Button" />

</form>
f) Pull down menus:

Pull down menu is used when we have many options available to be selected
but only one or two will be selected..

Here is example HTML code for a form with one Pull down menu

The result of this code is the following form

Submit

Following is the list of important attributes of <select>:

name: This is the name for the control.

size: This can be used to present a scrolling list box.

multiple: If set to "multiple" then allows a user to select multiple items from the
menu.

Following is the list of important attributes of <option>:

value: The value that is sent to the server if this option is selected.

selected: Specifies that this option should be the initially selected value when the
page loads.

label: An alternative way of labeling options.

c) Pop ups:
The technique described here addresses all the major issues
in popups. The popup always comes to the front. Different links can target the
same popup.
Creating a popup

To create a popup you'll need the following script:

<script language="javascript" type="text/javascript">

<!--

function popitup(url) {

newwindow=window.open(url,'name','height=200,width=150');

if (window.focus) {newwindow.focus()}

return false;

// -->

</script>

Part-B

Q4. How inline frames are useful. Explain with example.


Ans: Inline Frames - The <iframe> Element:

The <iframe> tag is not used within a <frameset> tag. Instead, it appears anywhere in
your document. The <iframe> tag defines a rectangular region within the document in
which the browser displays a separate document, including scrollbars and borders.

Use the src attribute with <iframe> to specify the URL of the document that occupies
the inline frame.
All of the other, optional attributes for the <iframe> tag, including name, class,
frameborder, id, longdesc, marginheight, marginwidth, name, scrolling, style, and title
behave exactly like the corresponding attributes for the <frame> tag.

Following is the example to show how to use the <iframe>. This tag is used along with
<body> tag:

<body>
...other document content...
<iframe src="/html/menu.htm" width="75" height="200" align="right">
Your browser does not support inline frames. To view this
<a href="/html/menu.htm">document</a> correctly, you'll need
a copy of Internet Explorer or the latest Netscape Navigator.
</iframe>
...subsequent document content...
</body>

Q5. Using suitable example, enumerate the purpose of Global and ass
files in ASP.
ANS:- Ans: The Global.asa file is an optional file that can contain declarations of
objects, variables, and methods that can be accessed by every page in an ASP
application.

All valid browser scripts (JavaScript, VBScript, JScript, PerlScript, etc.) can be used
within Global.asa.

The Global.asa file can contain only the following:

• Application events

• Session events

• <object> declarations

• TypeLibrary declarations

• the #include directive

For example we will create a Global.asa file that counts the number of current visitors.

• The Application_OnStart sets the Application variable "visitors" to 0 when the server
starts
• The Session_OnStart subroutine adds one to the variable "visitors" every time a new
visitor arrives

• The Session_OnEnd subroutine subtracts one from "visitors" each time this
subroutine is triggered

Q6. Write the steps for database connectivity for a


web page? Give example.

ANS:- Establishing a JDBC database connection in two steps

Once you have the correct JDBC driver installed, establishing a JDBC connection from
your Java programs to your SQL database is pretty easy.

Regardless of whether you're trying to connect to Oracle, SQL Server, MySQL,


Postgres, mSQL, or Interbase (or any other JDBC data source), establishing a
connection to an SQL database with Java JDBC is a simple two-step process:

 Load the JDBC driver.

 Establish the JDBC connection to your database.

Two JDBC examples

A Mini SQL JDBC example


Listing 1 provides the full source code required to establish a JDBC connection to a
mSQL database on a server named "www.myserver.com".

/ Establish a connection to a mSQL database using JDBC.

import java.sql.*;

class JdbcTest1 {

public static void main (String[] args) {


try

// Step 1: Load the JDBC driver.

Class.forName("com.imaginary.sql.msql.MsqlDriver");

// Step 2: Establish the connection to the database.

String url = "jdbc:msql://www.myserver.com:1114/contact_mgr";

Connection conn = DriverManager.getConnection(url,"user1","password");

catch (Exception e)

System.err.println("Got an exception! ");

System.err.println(e.getMessage());

An Interbase JDBC ODBC example


Listing 2 provides the full source code required to establish a JDBC connection to an
Interbase database. In this example, we're connecting to a local Interbase server using
the JDBC ODBC bridge driver after setting up Interbase as an ODBC datasource on the
local system.

// Establish a connection to an Interbase database using JDBC and ODBC.

import java.sql.*;

class JdbcTest1

{
public static void main (String[] args)

try

// Step 1: Load the JDBC ODBC driver.

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

// Step 2: Establish the connection to the database.

String url = "jdbc:odbc:contact_mgr";

Connection conn = DriverManager.getConnection(url,"user1","password");

catch (Exception e)

System.err.println("Got an exception! ");

System.err.println(e.getMessage());

You might also like