Friday 15 January 2021

PHP-SEM3

 

1]Write a PHP script for the following: Design a form to accept a string. Write a function to count the total number of vowels (a,e,i,o,u) from the string. Show the occurrences of each vowel from the string. Check whether the given string is a palindrome or not, without using built-in function. (Use radio buttons and the concept of function. Use ‘include’ construct or require stmt.)               

2]Write a PHP script for the following:Design a form to accept two strings from the user. Find the first occurrenceand the last occurrence of the small string in the large string. Also count thetotal number of occurrences of small string in the large string. Provide a textbox to accept a string, which will replace the small string in the largestring. (Use built-in functions)

 3]Write a PHP script for the following:Design a form to accept two numbers from the user. Give options to choose thearithmetic operation (use radio buttons). Display the result on the next form.(Use the concept of function and default parameters. Use ‘include’ construct orrequire stmt).

 

4]Write a PHP script for the following: Design a form to accept two strings from the user. Find whether the small string appears at the start of the large string. Provide a text box to accept the string that will replace all occurrences of small string present in the large string. Also split the large string into separate words. (Use regular expressions)           

 

5]Write a PHP script for the following: Design a form to accept the details of 5 different items, such as item code, item name, units sold, rate. Display the bill in the tabular format. Use only 4 text boxes. (Hint : Use of explode function.)                   

 

6]Write a PHP script for the following: Design a form to accept two strings. Compare the two strings using both methods (= = operator &strcmp function). Append second string to the first string. Accept the position from the user; from where the characters from the first string are reversed. (Use radio buttons)

7]Write a menu driven PHP program to perform the following operations on an associative array:

i.Display the elements of an array along with the keys.

ii.Display the size of an array

iii.Delete an element from an array from the given index.

iv.Reverse the order of each element’s key-value pair.[Hint: use array_flip()]

v.Traverse the elements in an array in random order [[Hint: use shuffle()].  

 

8]Write a menu driven PHP program to perform the following operations on associative arrays:

a)Sort the array by values (changing the keys) in ascending, descending order.

b)Also sort the array by values without changing the keys.

c)Filter the odd elements from an array.

d)Sort the different arrays at a glance using single function.

e)Merge the given arrays.

 f) Find the Union, intersection& set difference of two arrays.

9]Write PHP script to define an interface which has methods area(), volume(). Define constant PI. Create a class cylinder which implements this interface and calculate area and volume.                                                                                                    

10]Write class declarations and memberfunction definitions for an employee(code, name, designation). Design derivedclasses as emp_account(account_no, joining_date) from employee and emp_sal(basic_pay,earnings, deduction) from emp_account. Write a menu driven PHP program a) tobuild a master table b) to sort all entries c) to search an entry d) Displaysalary

 11]Derive a class square from classRectangle. Create one more class circle. Create an interface with only onemethod called area().Implement this interface in all the classes. Includeappropriate data members and constructors in all classes. Write a PHP programto accept details of a square, circle and rectangle and display the area.

 12]Write PHP Script to create a class account(accno,cust_name). Derive two classes from account as saving_acc(balance, min_amount) and current_acc(balance, min_amount). Display a menu a)Saving Account b)Current Account For each of this display a menu with the following options. 1. Create account 2. Deposit 3.Withdrawal 

 13]Implement calculator to convertdistances between (both ways) miles and kilometres. One mile is about 1.609kilometres. User interface (distance.html) has one text-input, two radio-buttons,submit and reset -buttons. Values are posted to PHP-script (distance.php) whichcalculates the conversions according the user input.

 14]Using regular expressions check for the validity of entered email-id. The @ symbol should not appear more than once. The dot (.) can appear at the most once before @ and at the most twice or at least once after @ symbol. The substring before @ should not begin with a digit or underscore or dot or @ or any other special character. (Use explode and ereg function.)

           

15]Write PHP program to create input form for Grocery that displays List of grocery items with checkboxes and create a bill according to list of items selected after clicking submit button.

 16]Write a PHP program that accept customer name, consumer number and number of electricity units consumed from an input form and print electricity bill from following data

•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

•Fixed meter and service charge- Rs. 150/-   

 17]Write a PHP program for course registration of Learner in an institute that accept Name, Course to be admitted, Mobile number using input form validation such as Name should be only string of character, mobile number should contain digits with valid length and so on. and give feedback to Learner with registration details including registration number.

 18]Write a PHP script to create a login form with a username and password. Once the user logs in, the second form should be displayed to accept user details (name, city, phoneno). If the user doesn’t enter information within a specified time limit, expire his session and give a warning.

 19]Write a PHP script to keep track ofnumber of times the web page has been accessed.

 20]Write a PHP script to change thepreferences of your web page like font style, font size, font color, backgroundcolor using cookie. Display selected settings on next web page and actualimplementation (with new settings) on third web page.

 21]Write a PHP script to create a formto accept student information (name, class, address). Once the studentinformation is accepted, accept marks in next form (Phy, Bio, Chem, Maths,Marathi, English).Display the mark sheet for the student in the next form containingname, class, marks of the subject, total and percentage

 22]Write a PHP program to create ashopping mall UI. User must be allowed to do purchase from two pages. Each pageshould have a page total. The third page should display a bill, which consistsof a page total of whatever the purchase has been done and print the total.(Use http session tracking).

 23]Write a PHP script to create a formto accept customer information (name, address, ph-no). Once the customerinformation is accepted, accept product information in the next form (Productname, qty, rate). Display the bill for the customer in the next form. Billshould contain the customer information and the information of the productsentered.

 24]Write a PHP script to accept username and password. If in the first three chances, username and password entered is correct, then display second form, otherwise display error message.       

25]Consider the following entities and their relationships

Emp (emp_no,emp_name,address,phone,salary)

Salary(em_pno, Basic, HR, TA, DA)

Dept (dept_no,dept_name,location)

Emp-Dept are related with one-many relationship Create a RDB for the above and solve following Using above database. write a PHP script which will print a salary statement for specified emp_no with his details.

  26]Consider the following entities and their relationships Doctor (doc_no, doc_name, address, city, area) Hospital (hosp_no, hosp_name, hosp_city) Doctor and Hospital are related with many-many relationship. Create a RDB in 3 NF for the above and solve following Using above database, write a PHP script which accepts hospital name and print information about doctors visiting / working in that hospital in tabular format.                      

 27]Considerer the following entities and their relationships project(pno integer, p_name char(30), ptype char(20),duration integer), employee (eno integer, e_name char (20), qualification char (15), joindate date) .The relationship between project - employee: M-M, with descriptive attributes as start_date (date), no_of_hours_worked (integer). Using above database write a script in PHP to accept a project name from user and display information of employees working on the project.

 28]Consider the following entities and their relationships

student (sno integer, s_name char(30), s_class char(10), s_addr char(50)),

teacher (tno integer, t_name char (20), qualification char (15),experience integer).

The relationship between student-teacher: m-m with descriptive attribute subject. Using above database write a script in PHP to accept a teacher name from user and display the names of students along with subjects to whom teacher is teaching.

 29]Consider the following entities and their relationships

Movie (movie_no, movie_name, release_year)

Actor (actor_no, name)

Relationship between movie and actor is many – many with attribute rate in Rs.

Create a RDB in 3NF for the above and solve following Using above database,

write PHP scripts for the following:(Hint: Create HTML form having three radio buttons)

a)Accept actor name and display the names of the movies in which he has acted.

b)Insert new movie information.

c)Update the release year of a movie. (Accept the movie name from user)

 30]Considerer the following entities and their relationships

Student (Stud_id,name,class)

Competition (c_no,c_name,type)

Relationship between student and competition is many-many with attribute rank and year. Create a RDB in 3NF for the above and solve the following. Using above database write a script in PHP to accept a competition name from user and display information of student who has secured 1st rank in that competition.