You are on page 1of 1

<!--Write php program to check whether a given <!—Display the Bio Data of a person --> <!

—list of fruits -->


number is armstrong or not.--> <html> <html>
<html> <head><title>Bio Data</title> <body align="center">
<head> </head> <h1>Fruits</h1>
<title>Armstrong Number or not</title> <body> <h3>
</head> <center> <form method="post" action="#">
<body bgcolor="yellow"> <form method="get" action="#"> <label>What do you want in your List:</label>
<form method="get" action="#"> <div><h1><u><b>Bio DATA</u></b></h1> <br>
<label id="l1">Enter No:</label> <div><label name="l1"> <select name="foods[]" size="5" multiple="multiple">
<input type="number" id="num" name="num" Enter Name: </label> <option value="Apple">Apple</option>
placeholder="Enter Number"><br> <input type="text" name="name" id="name" <option value="Orange">Orange</option>
<input type="submit" name="ok" value="OK"> placeholder="Enter your name"></div> <option value="Grape">Grape</option>
</form> <div><label name="l2"> <option value="Pineapple">Pineapple</option>
</body> Email: </label> <option Value="Kevi">Kevi</option>
</html> <input type="email" name="email" id="email" <option Value="banana">banana</option>
<?php placeholder="Enter you email"></div> </select>
if(isset($_GET['ok'])) <div><label name="l3"> <input type="submit" name="ok" id="ok"
{ Date of Birth</label> value="Validate">
$n=$_GET['num']; <input type="date" name="dob" id="dob" </form></body>
$x=$n; placeholder="Enter DOB"></div> </html>
$sum=0; <div><label name="l4"> <?php
while($x!=0) Address:</label> $CHOICES=$_POST['foods'];
{ <textarea name="address" id="address" height="5" if(isset($CHOICES))
$rem=$x%10; width="30" placeholder="Enter {
$sum=$sum+($rem*$rem*$rem); Address"></textarea></div> echo"You have chosen the fruits from the list:<br>";
$x=$x/10; <div><label name="l5"> foreach($CHOICES as $key=>$value)
} Gender:</label> echo $value."<br>";
if($n==$sum) Male<input type="radio" name="gender" id="gender" }
echo"<script>alert($n+' is Armstrong value="male"> else
Number...');</script>"; Female<input type="radio" name="gender" echo "You haven't selected any Fruits..";
else id="gender" value="female"> ?>
echo"<script>alert($n+' is not Armstrong Other<input type="radio" name="gender"
Number...')</script>;"; id="gender" value="other"></div> <!—store 10 names in the array -->
} <div><label name="l6"> <!doctype html>
?> Phone no:</label> <html>
<input type="text" name="phno" id="phno" <body>
<!--Fibonacci Series of a number--> placeholder="Enter Phone number"></div><br> <?php
<html> <input type="submit" name="ok" id="ok" $students=array('Anu','Ginu','Hima','Jiya','Binu','Cija','Fi
<body> value="Validate"> jas','Diya');
<form method="get" action="#"> <input type="Reset" value="RESET"> echo "(A).Display Using foreach loop:<br>";
<label> </div> foreach($students as $stud)
Enter the Limit:</label> </form> echo $stud."<br>";
<input type="number" id="limit" name="limit" </body> echo "<br>(B).Display array in Sorted order:<br>";
placeholder="Enter Value"><br><br> </html> sort($students);
<input type="Submit" name="submit" id="submit" <?php foreach($students as $stud)
value="OK"> if(isset($_GET['ok'])) echo $stud."<br>";
</form></body> { echo "<br>(C).Display array without duplicate
</html> $name=$_GET['name']; Elements:<br>";
<?php $email=$_GET['email']; $result=array_unique($students);
if(isset($_GET['submit'])) $dob=$_GET['dob']; print_r($result);
{ $address=$_GET['address']; echo "<br><br>(D).Remove last Element of
$l=$_GET['limit']; $gender=$_GET['gender']; array:<br>";
$a=0; $phno=$_GET['phno']; $removed=array_pop($students);
$b=1; echo"<h1><u><b>Bio Data echo "Removed array element is:".$removed;
$c=$a+$b; Details:</u></b></h1><br>"; echo "<br>Updated Array:";
echo"Fibonacci Series :<br><br>".$a.", ".$b.", ".$c.", "; echo"<h3> Name: ".$name."<br> Email: ".$email."<br> print_r($students);
while($c<$l) Date of Birth:".$dob."<br> Address:".$address."<br> echo "<br><br>(E).Display array in Reverse
{ Gender:".$gender."<br> phone no:".$phno."</h3>"; order:<br>";
$a=$b; } $y=array_reverse($students);
$b=$c; ?> print_r($y);
$c=$a+$b; echo "<br>(F).Search an Element in the Given Array:
if($c<=$l) <!—login page using database --> <br>";
{ <html> if(in_array("Anu",$students))
echo $c.", "; <body align="center"> {
} <form method="post" action="#"> echo "Element Found!!";
} <h1><u><b>Login Page</b></u></h1> }
} <h3> else
?> <label name="usrname">User name: </label> echo "Element not Found!!";
<input type="text" name="usrname" id="usrname" ?>
<!—Reverse of a string --> placeholder="Enter Name"><br> </body>
<?php <label name="passwd">Password: </label><input </html>
function reverse() type="password" name="paswd" id="paswd"
{ placeholder="Enter Password"><br> <!—mark ist -->
$string="RED"; <input type="submit" name="ok" id="ok" <html>
echo"The Reverse of ".$string." :"; value="Login"> <body alogn="center">
$l=strlen($string); <input type="reset" name="cancel" id="cancel" <h1><b><u>Student Details</h1></b></u>
for($i=($l-1);$i>=0;$i--) value="Cancel"> <h3>
echo $string[$i]; </h3></form> <form method="post" action="#">
} </body> Register no:<input type="text" name="regno"
reverse(); </html> id="regno" placeholder="Enter Regno">
?> <?php <input type="submit" value="Validate" name="ok"
$db_connection=pg_connect("host=localhostdbname= id="ok">
<!—Perfect Abundant Deficient --> lab1 user=postgres password=ncas"); </form>
<html> if(isset($_POST['ok'])) </body></html>
<body> { <?php
<form method="post" action="#"> $u=$_POST['usrname']; $db_connection=pg_connect("host=localhost
<label>Enter a Number: </label> $p=$_POST['paswd']; dbname=student user=postgres password=1234");
<input type="number" name="num" id="num" $result=pg_query($db_connection,"select * from login if($_POST)
placeholder="Enter Number"> where username='$u' and password='$p'"); {
<input type="Submit" name="ok" id="ok"> if(pg_num_rows($result)>0) $u=$_POST['regno'];
</form> echo "<script>alert('Welcome!');</script>"; $result=pg_query($db_connection,"select * from
</body> else student where rollno='$u'");
</html> echo "<script>alert('Login FAILED!!');</script>"; if(pg_num_rows($result)<1)
<?php } echo "No scores found";
if(isset($_POST['ok'])) ?> else
{ $res=pg_fetch_array($result);
$n=$_POST['num']; <!—last visit date & time --> ?>
$sum=0; <html> <table border="3">
for($i=1;$i<$n;$i++) <body align="center"> <tr>
{ <b><h1>Last visited Time on Webpage</b></h1> <th>Rollno</th>
if($n%$i==0) <br> <th>Name</th>
{ </body> <th>Mark</th>
$sum=$sum+$i; </html> <th>Grade</th></tr>
} <?php <?php
} date_default_timezone_set('Asia/calcutta'); echo"<tr>";
if($sum==$n) $intwomonths=60*60*24*60+time(); echo"<td>$res[0]</td>";
echo "<script>alert($n+' is Perfect...');</script>"; setcookie('lastvisit',date("h:i:s-m/d/y"),$intwomonths); echo"<td>$res[1]</td>";
else if($sum>$n) if(isset($_COOKIE['lastvisit'])) echo"<td>$res[2]</td>";
echo $n.' is Abundant'; { echo"<td>$res[3]</td>";
else $visit=$_COOKIE['lastvisit']; }
echo $n.' is Deficient.'; echo "You last Visit was-".$visit; ?>
} }
?> else
echo "You have got some State Cookies";
?>

You might also like