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

Record Programs With Soln

The document outlines 15 programming tasks related to web development using HTML, CSS, JavaScript, PHP and MySQL. The tasks include designing basic webpages, adding validation and scrolling text using JavaScript, performing CRUD operations on a database using PHP and MySQL, calculating bills and reports, and building applications for registration, employee details, books, and student information management.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Record Programs With Soln

The document outlines 15 programming tasks related to web development using HTML, CSS, JavaScript, PHP and MySQL. The tasks include designing basic webpages, adding validation and scrolling text using JavaScript, performing CRUD operations on a database using PHP and MySQL, calculating bills and reports, and building applications for registration, employee details, books, and student information management.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

1

Web Programming using PHP – Record programs

1. Design a Webpage which contains a sample registration form [Use HTML


only]
2. Design a webpage for your college website [Use basic HTML tags and
CSS]
3. Design a webpage which displays a Scrolling text. Use CSS and javascript
to change the color of the text while scrolling.
<html><head>
<script language="javascript">
function chm()
{
document.getElementById("n").style.color="violet";
setTimeout(chm1,2000)
}
function chm1()
{
document.getElementById("n").style.color="indigo";
setTimeout(chm2,2000)
}
function chm2()
{
document.getElementById("n").style.color="blue";
setTimeout(chm3,2000)
}
function chm3()
{
document.getElementById("n").style.color="green";
setTimeout(chm4,2000)
}
function chm4()
{
document.getElementById("n").style.color="yellow";
setTimeout(chm5,2000)
}
function chm5()
2
Web Programming using PHP – Record programs

{
document.getElementById("n").style.color="orange";
setTimeout(chm6,2000)
}
function chm6()
{
document.getElementById("n").style.color="red";
setTimeout(chm7,2000)
}
function chm7()
{
document.getElementById("n").style.color="aqua";
setTimeout(chm,2000)
}
</script>
</head>
<body onload="chm()">
<marquee id="n"><h1>WEB PROGRAMMING USING PHP</h1>
</marquee></BODY></HTML>
4. Design a student registration page using HTML. Add proper validations
using javascript.
<html> <head> <title>Style demo</title>
<script language="javascript">
function val()
{
var firstname=document.forms["f1"]["fn"].value;
var phone=document.forms["f1"]["ph"].value;
var addr=document.forms["f1"]["add"].value;
if(firstname=="")
{
alert("Name field is empty");
document.forms["f1"]["fn"].value=prompt("Name field is empty");
3
Web Programming using PHP – Record programs

return false;
}
if (isNaN(phone) )
{
alert("phone number is not numeric"); return false;
}
if(addr=="")
{
alert("Address field is empty"); return false;
}
if(confirm("Form is about to save ... Are you sure ?"))
return true;
}
</script> </head>
<body>
<h1>Registration</h1>
<form name="f1" action="" onsubmit="return val()" >
Enter Name <input type="text" name="fn"> <br><br>
Enter Phone number <input type="text" name="ph"> <br><br>
Enter address <textarea name="add"></textarea><br><br>
<input type="submit" name="s" value="save" >
</form> </body></html>
5. Write a php program to find factorial of a number
<?php
$n=8; $f=1;
for($i=1;$i<=$n;$i++)
$f=$f*$i;
4
Web Programming using PHP – Record programs

echo "Factorial is ".$f;


?>
6. Write a program in PHP to Sort an array
<?php
$arr=array(41,22,13,64,25);
for($i=0;$i<count($arr);$i++)
{
for($j=$i+1;$j<count($arr);$j++)
{ if($arr[$i]>$arr[$j])
{
$temp=$arr[$i]; $arr[$i]=$arr[$j]; $arr[$j]=$temp;
}
}
}
echo "sorted array is <br>";
for($i=0;$i<count($arr);$i++)
echo $arr[$i]."<br>";
?>
7. Write a PHP program to convert word to digit.
Input: zero;three;five;six;eight;one
Output: 035681
<?php
function word_digit($word)
{
$warr = explode(';',$word); $result = '';
foreach($warr as $value)
{
5
Web Programming using PHP – Record programs

switch(trim($value))
{
case 'zero':
$result .= '0'; break;
case 'one':
$result .= '1'; break;
case 'two':
$result .= '2'; break;
case 'three':
$result .= '3'; break;
case 'four':
$result .= '4'; break;
case 'five':
$result .= '5'; break;
case 'six':
$result .= '6'; break;
case 'seven':
$result .= '7'; break;
case 'eight':
$result .= '8'; break;
case 'nine':
$result .= '9'; break;
}
} return $result;
}
echo word_digit("zero;three;five;six;eight;one")."<BR>";
echo word_digit("seven;zero;one")."<BR>";
6
Web Programming using PHP – Record programs

$s= word_digit("two;five;seven;zero");
echo $s;
?>
8. Write To Understand how to create session
<?php
session_start();
if( isset( $_SESSION['counter'] ) ) {
$_SESSION['counter'] += 1;
}else {
$_SESSION['counter'] = 1;
}
$msg = "You have visited this page ". $_SESSION['counter'];
$msg .= " in this session.";
?>
<html>
<head>
<title>Setting up a PHP session</title>
</head>
<body>
<?php echo ( $msg ); ?>
</body>
</html>
9. Write a PHP program to count the words in the string which is entered
through a textfield.
<html> <head><title></title></head>
<body>
<form method="get" action="pgm9code.php">
7
Web Programming using PHP – Record programs

<textarea name="txt" rows=5 cols=25></textarea>


<input type="submit" name="s" value="Count words">
</form> </body></html>
<?php
$str=$_GET['txt'];
$words=explode(" ",$str);
echo count($words);
?>
10. Design the personal information form and submit data using php $_POST
or $_GET or $ REQUEST variable.
<html><head><title>Untitled Document</title></head>
<body>
<form action="urcode.php" method="get">
<table width="495" height="211" border="0">
<tr> <td>NAME OF CUSTOMER </td>
<td><input type="text" name="cname"></td> </tr>
<tr> <td>ADDRESS</td>
<td><textarea name="add"></textarea></td> </tr>
<tr> <td>PHONE</td> <td><input type="text" name="ph"></td> </tr>
<tr> <td><input type="reset" name="Submit2" value="Reset"></td>
<td><input type="submit" name="Submit" value="Submit"></td> </tr>
</table></form></body></html>
--------------------------------------------------------------------------
<?php
$cn=$_REQUEST['cname']; $ad=$_REQUEST['add'];
$phone=$_REQUEST['ph'];
$con=mysql_connect("localhost","root","");
8
Web Programming using PHP – Record programs

mysql_select_db("MYDATA",$con);
$qry="insert into userreg VALUES('$cn','$ad','$phone')";
$i=mysql_query($qry,$con);
if($i>0)
echo "data inserted successfully";
?>
11. Build a web application to accept book information viz. Accession
number, title, authors, edition and publisher from a web page and store the
information in a database and to search for a book with the title specified
by the user and to display the search results with proper headings. Also
perform insert, delete and edit operation. [Hint: use PHP, CSS, and
MySQL. Check all validations and add proper constraints for tables]
12.Employee Details, to perform display, insert, update & delete operations on
employee details using php, CSS,HTML and MySQL database.[Hint:
create tables add proper constraints, check all validations]
13.Create a web application using PHP, CSS & MYSQL program to prepare a
Bill for a super market. Perform insert, delete, edit and search
operations.[Hint: Create minimum two tables, check all validations and add
proper constraints for tables]
14.Write a web program to calculate electricity bill. Perform insert, delete, edit
and search operations.[Hint: use PHP, MySQL, CSS, html create tables add
proper constraints, check all validations, Conditions: For first 50 units – Rs.
3.50/unit. For next 100 units – Rs. 4.00/unit, For next 100 units – Rs.
5.20/unit For units above 250 – Rs. 6.50/unit]
15. Design a web application for Student Information system. create
tables and add proper constrains. Perform insert, delete and search
operation. Also produce the report for a particular item and all items.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy