Iwt Practical
Iwt Practical
LECTURER
ER. HESHAM AKHTER
1|Page
19048112004 ABRAR SHAH
PRACTICAL PRACTICAL
NO.
01 INTRODUCTION TO HTML
03 LINK IN HTML
04 LIST IN HTML
05 TABLES IN HTML
06 FORMS IN HTML
07 FRAMES IN HTML
12 INTRODUCTION TO PHP
13 PHP ARRAY
15 SQL CONNECTIVITY
2|Page
19048112004 ABRAR SHAH
OUTPUT
PRACTICAL 2
IMAGE UPLOAD IN HTML
3|Page
19048112004 ABRAR SHAH
Images are not technically inserted into a web page; images are linked to web pages. The <img> tag
creates a holding space for the referenced image.
alt - Specifies an alternate text for the image, if the image for some reason cannot be displayed
<html>
<body>
</body>
</html>
OUTPUT
PRACTICAL 3
HTML LINKS – HYPERLINKS
4|Page
19048112004 ABRAR SHAH
When you move the mouse over a link, the mouse arrow will turn into a little hand.
The most important attribute of the <a> element is the ( href ) attribute, which indicates the
link's destination. The link text is the part that will be visible to the reader. Clicking on the link
text, will send the reader to the specified URL address.
EXAMPLE
<!DOCTYPE html>
<html>
<body>
<h1>HTML Links</h1>
</body>
</html>
OUTPUT
PRACTICAL 4
HTML LISTS
HTML lists allow web developers to group a set of related items in lists.
5|Page
19048112004 ABRAR SHAH
An unordered list starts with the <ul> tag. Each list item starts with
the<li> tag. The list items will be marked with bullets.
An ordered list starts with the <ol> tag. Each list item starts with the
<li> tag. The list items will be marked with numbers by default.
EXAMPLE
<!DOCTYPE html>
<html>
<body>
6|Page
19048112004 ABRAR SHAH
</body>
</html>
PRACTICAL 5
TABLES IN HTML
HTML tables allow web developers to arrange data into rows and columns. A
table in HTML consists of table cells inside rows and columns. The table is
used by <table> tag.
Each table row starts with a <tr> and ends with a </tr> tag. tr stands for
table row.
Each table cell is defined by a <td> and a </td> tag. td stands for table
data. Everything between <td> and </td> are the content of the table cell.
Sometimes you want your cells to be headers. In those cases use the
<th> tag instead of the <td> tag.
EXAMPLE
<!DOCTYPE html>
<html>
<style>
7|Page
19048112004 ABRAR SHAH
table, th, td {
border:1px solid black;
}
</style>
<body>
<h2>TH elements define table headers</h2>
<table style="width:100%">
<tr>
<th>Person 1</th>
<th>Person 2</th>
<th>Person 3</th>
</tr>
<tr>
<td>Emil</td>
<td>Tobias</td>
<td>Linus</td>
</tr>
<tr>
<td>16</td>
<td>14</td>
<td>10</td>
</tr>
</table>
<p>To undestand the example better, we have added borders to the table.</p>
</body>
</html>
8|Page
19048112004 ABRAR SHAH
PRACTICAL 6
FORMS IN HTML
An HTML form is used to collect user input. The user input is most often
sent to a server for processing.
The HTML <form> element is used to create an HTML form for user input.
The <form> element is a container for different types of input elements,
such as: text fields, checkboxes, radio buttons, submit buttons, etc.
EXAMPLE
<!DOCTYPE html>
<head>
<title>Forms</title>
</head>
<body>
<table border="4">
<form>
<tr><th>name</th><td><input type="text"></td></tr>
<tr><th>password</th><td><input type="password"></td></tr>
<tr><th>enter your hobbies:</th><td><input type="checkbox" value="on"
name="a">Travel</br>
<input type="checkbox" value="on" name="b">reading</br>
<input type="checkbox" value="on" name="c">gardening</br>
</td></tr>
9|Page
19048112004 ABRAR SHAH
PRACTICAL 7
FRAMES IN HTML
The <frame> tag was used in HTML 4 to define one particular window
(frame) within a <frameset>.
EXAMPLE
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
10 | P a g e
19048112004 ABRAR SHAH
<title>Frames</title>
</head>
<frameset cols="50%,50%">
<frame src="greatetof3.html"></frame>
<frame src="add.html"></frame>
</frameset>
</html>
PRACTICAL 8
INTRODUCTION TO CSS & USAGE
Cascading Style Sheets (CSS) provide easy and effective alternatives to specify various
attributes for the HTML tags. Using CSS, you can specify a number of style properties for a
given HTML element. Each property has a name and a value, separated by a colon (:). Each
property declaration is separated by a semi-colon (;).
1. External Style Sheet − Define style sheet rules in a separate .css file and then include that file in
your HTML document using HTML <link> tag.
11 | P a g e
19048112004 ABRAR SHAH
2. Internal Style Tag − Define style sheet rules in header section of the HTML document
using <style> tag.
3. Inline Style Sheet − Define style sheet rules directly along-with the HTML elements using style
attribute.
PRACTICAL 9
INTRODUCTION TO JAVA SCRIPT
A script is a small piece of program that can add interactivity to your website. JavaScript makes
HTML pages more dynamic and interactive. For example, a script could generate a pop-up alert box
message, or provide a dropdown menu. This script could be written using JavaScript. You can write
various small functions, called event handlers using any of the scripting language and then you can
trigger those functions using HTML attributes.
Now-a-days, only JavaScript and associated frameworks are being used by most of the web
developers. You can keep JavaScript code in a separate file and then include it wherever it's needed,
or you can define functionality inside HTML document itself as we have used the CSS
Event Handlers:
Event handlers are nothing but simply defined functions which can be called against any mouse or
keyboard event. You can define your business logic inside your event handler which can vary from a
single to 1000s of line code.
EXAMPLE
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function add()
var a = document.getElementById("a").value;
var b = document.getElementById("b").value;
document.write("addition is =",+c);
</script>
</head>
<body>
12 | P a g e
19048112004 ABRAR SHAH
<form>
</form>
</body>
</html>
PRACTICAL 10
VALIDATION IN JAVA SCRIPT
EXAMPLE
<!DOCTYPE html>
<html>
<head>
<script>
function validateForm() {
let x = document.forms["myForm"]["fname"].value;
if (x == "") {
return false;
</script>
</head>
<body>
<h2>JavaScript Validation</h2>
</form>
13 | P a g e
19048112004 ABRAR SHAH
</body>
</html>
PRACTICAL 11
CONDITIONAL IN JAVA SCRIPT
Very often when you write code, you want to perform different actions for
different decisions.
EXAMPLE
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function myf()
var a = parseInt(document.getElementById("a").value);
var b = parseInt(document.getElementById("b").value);
var c = parseInt(document.getElementById("c").value);
{ document.write("greatest no.",+a); }
{ document.write("greatest no.",+b); }
14 | P a g e
19048112004 ABRAR SHAH
else
{ document.write("greatest no.",+c); }
</script>
</head>
<body>
<form>
</form>
</body>
</html>
PRACTICAL 12
INTRODUCTION TO PHP
EXAMPLE
<!DOCTYPE html>
<html>
<body>
15 | P a g e
19048112004 ABRAR SHAH
<?php
?>
</body>
</html>
PRACTICAL 13
PHP ARRAY
An array stores multiple values in one single variable. An array is a special variable, which can
hold more than one value at a time. If you have a list of items (a list of car names, for example),
storing the cars in single variables could look like this.
$cars1 = "Volvo";
$cars2 = "BMW";
$cars3 = "Toyota";
An array can hold many values under a single name, and you can access the
values by referring to an index number.
array();
EXAMPLE
<!DOCTYPE html>
<html>
<body>
<?php
echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . ".";
?>
16 | P a g e
19048112004 ABRAR SHAH
</body>
</html>
PRACTICAL 14
CONDITIONAL STATEMENT IN PHP
Very often when you write code, you want to perform different actions for
different conditions. You can use conditional statements in your code to do
this.
if (condition) {
code to be executed if condition is true;
}
elseif (condition) {
code to be executed if first condition is false and this condition
is true;
}
else {
code to be executed if condition is false;
}
EXAMPLE
<!DOCTYPE html>
<html>
<body>
<?php
$t = date("H");
17 | P a g e
19048112004 ABRAR SHAH
} else {
?>
</body>
</html>
PRACTICAL 15
SQL CONNECTIVITY
Earlier versions of PHP used the MySQL extension. However, this extension was deprecated
in 2012.
EXAMPLE
<?php
$servername = "localhost";
$username = "username";
$password = "password";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>
18 | P a g e