practical - Week 6

2022-08-29

Practical 1: Complete the following php program and explain what it does ?

Practical 2: Complete the below code. Write a program to create a form with four field namely NAME,ADDRESS,AGE,PASSWORD. Now a user will enter name, address, age, PASSWORD then a file will create with name in data directory and all content will write in that file .

Practical 3: Write the code to start a session in php

<?php
// Start the session and get the data
session_start();
session_unset();
session_destroy();
echo "<br> You have been logged out";
?>
<?php
// Start the session and get the data
session_start();
if(isset($_SESSION['username'])){
    print "Welcome ". $_SESSION['username'];
    print "<br> Your favorite category is ". $_SESSION['favCat'];
    print "<br>";
}
else{
    print "Please login to continue";
}
?>