Lab Assignment – IV (PHP)
Write a simple PHP script that prints "Hello, PHP!" to the browser • Code
Declare variables of different data types (integer, float, string) and demonstrate the usage of constants in PHP • Code
Create a PHP program that uses if-else statements to check if a number is positive, negative, or zero. Utilize different operators for comparison • Code
Develop a function that calculates the average of an array of numbers. Test the function with various arrays • Code
Define a PHP class representing a "Book" with properties like title and author. Create objects of this class and display their attributes. • Code
Design a simple HTML form with input fields. Create a PHP script that retrieves and displays the form data when submitted. • Code
Enhance the previous form with PHP validation. Ensure that required fields are filled, and validate email addresses and make sure the phone number starts with 98 or 97 using regex • Code
Implement PHP code that responds to a button click event on a form. Display a message when the button is clicked • Code
Create a PHP script that sets a cookie with user preferences.Retrieve and display this information on subsequent visits • Code
Build a form with various elements (textboxes, checkboxes, radio buttons). Use PHP to access and display the selected values • Code
Develop a PHP script that reads content from a text file, modifies it, and then writes the updated content back to the file • Code
Lab 4.1 Connecting to database
Write PHP code to establish a connection to a MySQL database, including the necessary credentials • Code
Develop a PHP script to insert a new record into a MySQL database table.Ensure proper validation and sanitation of input data • Code
Create a PHP script that retrieves and displays all records from a MySQL database table • Code
Modify a specific record in a MySQL table using PHP. Ensure that the update is based on user input or specific criteria • Code
Implement PHP code to delete a record from a MySQL table. Provide options for the user to select the record to be delete • Code
Last updated