0% found this document useful (0 votes)
60 views

Practical-2A Aim: Write A Program To Design A Calculator Along With Data Validation Using PHP

The document describes a student's assignment to design a simple website using HTML and CSS. It includes code for 6 HTML pages (home, about, contact, registration, admission) that make up the basic structure and content of the website. The home page includes navigation links, an image, and footer. The other pages include headings, paragraphs of text describing the institution, and consistent navigation links.

Uploaded by

sunny
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

Practical-2A Aim: Write A Program To Design A Calculator Along With Data Validation Using PHP

The document describes a student's assignment to design a simple website using HTML and CSS. It includes code for 6 HTML pages (home, about, contact, registration, admission) that make up the basic structure and content of the website. The home page includes navigation links, an image, and footer. The other pages include headings, paragraphs of text describing the institution, and consistent navigation links.

Uploaded by

sunny
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 24

Practical- 2A

Aim: Write a program to design a calculator along with data validation using php.

Code: Calculator.php

<?php

if(isset($_GET["op"]))
{
$op= $_GET["op"];
$one= $_GET['first'];
$two= $_GET['second'];
$result;
if ($op=='+'){
$result= $one+$two;
}
elseif($op=='-')
{
$result= $one-$two;
}
elseif($op=='*')
$result= $one*$two;
elseif($op=='/')
{
if($two=='0')
$result= "<br>Denominator cannot be zero";
else
$result= $one/$two;
}
}
?>

<!Doctype html>
<html>
</br>
</br>
<input type="submit" value="submit" name="ready"/>
<br>
<br>

<label> Your result is: <?= $result ?> </label>

</form>
</body>
</html>

Output:
Practical-2B
Aim: Write a program to design a curency conveter program using php.

Code: converter.php

<?php

if(isset($_POST['submit'])){

$amount = $_POST['amount'];
$cur1 = $_POST['cur1'];
$cur2 = $_POST['cur2'];

if($cur1=="AUD" AND $cur2=="JPY"){


echo "<center><b>Your Converted Amount is:</b><br></center>";
echo "<center>" . $amount*73.25 . "</center>";
}

if($cur1=="AUD" AND $cur2=="INR"){


echo "<center><b>Your Converted Amount is:</b><br></center>";
echo "<center>" . $amount* 48.34 . "</center>";
}

if($cur1=="USD" AND $cur2=="JPY"){


echo "<center><b>Your Converted Amount is:</b><br></center>";
echo "<center>" . $amount* 107.88 . "</center>";
}

if($cur1=="USD" AND $cur2=="INR"){


echo "<center><b>Your Converted Amount is:</b><br></center>";
echo "<center>" . $amount* 71.18 . "</center>";
}

if($cur1=="AUD" AND $cur2=="PHP"){


<div id="box">
<h2>Currency Converter</h2>
<table>
<tr>
<td>
Enter Amount:<input type="text" name="amount"><br>
</td>
</tr>
<tr>
<td>
<br><center>From:<select name='cur1'>
<option value="AUD">Australian Dollor(AUD)</option>
<option value="USD" selected>US Dollar(USD)</option>
</select>
</td>
</tr>
<tr>
<td>
<br><center>To:<select name='cur2'>
<option value="INR" selected >Indian Rupee(INR)</option>
<option value="JPY">Japanese Yen(JPY)</option>
<option value="PHP">PHilippine Peso(PHP)</option>

</select>
</td>
</tr>
<tr>
<td><center><br>
<input type='submit' name='submit' value="CovertNow"></center>
</td>
</tr>
</table>
</form>
</body>
Aim: Write a program to design a webcounter using php.

Code: webcounter.php

<?php

if(isset($_GET['cnt'])){
$a= $_GET['one'];
$a++;
}
else
$a=0;
?>

<!Doctype html>
<html>
<head Counter </head>
<body>

<h2> Webcounter Program </h2>


<form method="get">
<input type="hidden" name="one" value="<?php echo $a; ?>"/>
<br>

<input type="submit" name="cnt" value="Count" />


<br>
<br>
Count is: <?php echo $a; ?>
</form>
</body>

Output:
Aim: Write a program to design a guessing game using php.

Code: guess.php

<!Doctype html>
<html>
<head>
</head>
<body>

<h2> Guess The Correct Number </h2>


<form method="post">
<input type="text" name="num"/>
</br>
</br>
<input type="submit" value="Guess a number between 1 to 9 "/>
</form>

<?php

$num= $_POST['num'];
$guess= mt_rand(1,9);
if($num==$guess)
echo "<br>Yeaah! You Guessed Correct Number";
else
echo "<br>Try again! Correct number is $guess";
?>
</body>
</html>

Output:
Aim: Design a simple website by using basic html and css. Roll no-20

Code: home.html

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div style="height:100px; background-color:#3498DB">
<marquee>
<h1 style="color:white"> Vivekanad Institute of Technology </h1>
</marquee>

</div>

<ul style="float:right">
<li><a class="active" href="index.html">Home</a></li>
<li><a href="about.html">About</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="registration.html">Registration</a></li>
<li><a href="admission.html">Admissions</a></li>
</ul>
<img src="https://images.shiksha.com/mediadata/images/1553752427phpvP6G9K.png" alt="please
refresh the page"
style="width:900px; height:500px; margin-top:30px; margin-left:20%"
/>
<footer>
<h4 style="text-align:center;"> &copy; 2019 </h4>
</footer>
</body>
</html>

Output:
About.html Roll no-20

<!DOCTYPE html>

<html>

<head>

<link rel="stylesheet" href="styles.css">

</head>

<body>

<div style="height:100px; background-color:#3498DB">

<marquee>

<h1 style="color:white"> Vivekanad Institute of Technology </h1>

</marquee>

</div>

<ul style="float:right">

<li><a class="active" href="index.html">Home</a></li>

<li><a href="about.html">About</a></li>

<li><a href="contact.html">Contact</a></li>

<li><a href="registration.html">Registration</a></li>

<li><a href="admission.html">Admissions</a></li>

</ul>

<div>

<p>

<h1>Vision</h1>

<h3>To create a vibrant knowledge-oriented environment with innovative teaching practices and to
inculcate tradition of socially conscious application of technology.

</h3>

<h1>Missions</h1>

<h3>To encourage students to develop in an ambient environment of caring and of sharing


information.</h3>

<h3>To enable students to work towards excellence in their chosen fields with professional bent of
mind.</h3>
contact.html Roll no-20

</div>

<ul style="float:right">

<li><a class="active" href="index.html">Home</a></li>

<li><a href="about.html">About</a></li>

<li><a href="contact.html">Contact</a></li>

<li><a href="registration.html">Registration</a></li>

<li><a href="admission.html">Admissions</a></li>

</ul>

<div>

<p>

<h1>Vision</h1>

<h3>To create a vibrant knowledge-oriented environment with innovative teaching practices and to
inculcate tradition of socially conscious application of technology.

</h3>

<h1>Missions</h1>

<h3>To encourage students to develop in an ambient environment of caring and of sharing


information.</h3>

<h3>To enable students to work towards excellence in their chosen fields with professional bent of
mind.</h3>

</p>

</div>

<footer>

<h4 style="text-align:center;"> &copy; 2019 </h4>

</footer>

</body>

</html>

Registration.html

<!DOCTYPE html>

<html>

<head>

<link rel="stylesheet" href="styles.css">

</head>

<body>
Roll no-20

Registration.html

<label>Enter your email</label><br>

<input type="email" name="email"><br>

<label>Enter your password</label><br>

<input type="password" name="pass"><br>

<label>confirm your password</label><br>

<input type="password" name="pass"><br>

<br><label>Enter your gender</label><br>

<input type="radio" id="gender" name="gender" value="male"/>Male <br>

<input type="radio" id="gender" name="gender" value="female"/>Female <br/>

<input type="radio" id="gender" name="gender" value="others"/>others <br/>

<br>Enter your Address:<br>

<textarea></textarea><br>

<input type="submit" value="sign-up">

</fieldset>

</div>

<footer>

<h4 style="text-align:center;"> &copy; 2019 </h4>

</footer>

</body>

</html>

Admission.html

<!DOCTYPE html>

<html>

<head>

<link rel="stylesheet" href="styles.css">

</head>

<body>

<div style="height:100px; background-color:#3498DB">

<marquee>
admission.html Roll no-20

</p>

<p>

<h4><br>

Bachelors in Engineering(B.E)

</h4>

<h4><br>

Masters in Engineering(M.E)

</h4>

</p>

</div>

<footer>

<h4 style="text-align:center;"> &copy; 2019 </h4>

</footer>

</body>

</html>

Output

You might also like