Practical-2A Aim: Write A Program To Design A Calculator Along With Data Validation Using PHP
Practical-2A Aim: Write A Program To Design A Calculator Along With Data Validation Using PHP
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>
</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'];
</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>
Output:
Aim: Write a program to design a guessing game using php.
Code: guess.php
<!Doctype html>
<html>
<head>
</head>
<body>
<?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;"> © 2019 </h4>
</footer>
</body>
</html>
Output:
About.html Roll no-20
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<marquee>
</marquee>
</div>
<ul style="float:right">
<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 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 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 enable students to work towards excellence in their chosen fields with professional bent of
mind.</h3>
</p>
</div>
<footer>
</footer>
</body>
</html>
Registration.html
<!DOCTYPE html>
<html>
<head>
</head>
<body>
Roll no-20
Registration.html
<textarea></textarea><br>
</fieldset>
</div>
<footer>
</footer>
</body>
</html>
Admission.html
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<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>
</footer>
</body>
</html>
Output