Web Technologies
Slip23
Q.1) Design HTML page to read the value for n. Write a PHP script to display first n even numbers with font size = 12 and color = red and first n odd numbers with font face = Times new Roman , size = 17 & color = yellow. [Marks30]
Solution
a.php
<html><body>
<?php
$a=$_POST['t1'];
echo"EVEN Numbers<br><br>";
for($i=1;$i<=$a;$i++)
{
if($i%2==0)
{
echo"<font size=\"12\" color=\"red\">$i </font>";
}
}
echo"<br><br>ODD Numbers<br><br>";
for($i=1;$i<=$a;$i++)
{
if($i%2!=0)
{
echo"<font size=\"17\" color=\"yellow\" face=\"Times New Roman\">$i </font>";
}
}
?>
</body>
</html>
b.html
<html><body>
<form action="a.php" method="post">
Enter Range <input type="text" name="t1">
<input type="submit">
</body>
</html>
Tags:
Web Technologies