Monday, 12 June 2023

Advance Php-Part 3

 

Q3) Attempt any Four of the following. [4×4=16]

 

a) Create a form to accept Customers Details and Display it on Next Page.

https://bcapractical2017.blogspot.com/2017/12/awt-slip5.html

b) Write a PHP script to Design a form to accept a number from the user to check whether number is palindrome or not. (Use the concept of self processing page).

 c) Write a PHP Script for the following : Design a form to accept a number from the user. To find Sum of the digits of the number (Use the concept of self processing page).

 

<html>

<head>

<title>palindrome and reverse</title>

</head>

<body>

<form action="<?php echo$_SERVER['PHP_SELF']?>" method=POST>

Enter Number :<input type=text name=t1><br>

<input type=radio name=r1 value=1>Check whether it is palindrome or not</br>

<input type=radio name=r1 value=2>Reverse the number using Recursion </br>

<input type=radio name=r1 value=3>Sum of digit Number</br>

 

<input type=submit value=convert></br>

</form>

<?php

            $num=$_POST['t1'];

            $op=$_POST['r1'];

            function palindrome($num)

            {

                  $temp=$num;

                        $m=0;

                        while($num>1)

                        {

                                    $r=$num%10;

                                    $m=$m*10+$r;

                                    $num=$num/10;

                        }

                        if($temp==$m)

                                    echo "It is Palindrome number ";

                        else

                                    echo "It is Not Palindrome number ";

            }

            function reverse($num)

            {

                        static $m=0;

                        if($num>1)

                        {

                                    $r=$num%10;

                                    $m=$m*10+$r;

                                    reverse($num/10);

                        }

                        else

                                    echo"Reverse of a number is :$m";

                                    }

           

function sum_of_digits($nums) {

    $digits_sum = 0;

      for ($i = 0; $i < strlen($nums); $i++) {

             $digits_sum += $nums[$i];

               }

      return $digits_sum;

}

echo sum_of_digits("12345")."\n";

         switch($op)

                        {

                        case 1:

                                    palindrome($num);

                                    break;

                        case 2:

                                    reverse($num);

                                    break;

                      case 3:

                                    sum_of_digits($digits_sum);

                                    break;

                        }

?>

  d) Write XML script to print the names of the students present in “Student.xml” file.

https://bcapractical2017.blogspot.com/2022/05/advance-php-slip2b-write-script-to.html

   e) Define a class Employee having private member id, name, salary, dept. Define parameterized constructor. Create object and display details fo employee having maximum salary.

https://bcapractical2017.blogspot.com/2017/12/awt-slip5.html

 f) Write a simple PHP program which implements AJAX for addition of two numbers.

https://bcapractical2017.blogspot.com/2017/12/awt-slip24.htm

 g) Create a form to accept Employee detail and display it in next page (Use sticky form concept)

https://bcapractical2017.blogspot.com/2017/12/awt-slip14.html

 h) Create an abstract Class shape with method area ( ) and volume ( ). Derive two classes rectangle (length, breath), Circle (radius). Calculate are and volume of all (Use Method Overriding)

https://bcapractical2017.blogspot.com/2022/05/advance-php-slip-5-create-abstract.html

 i) Write script to solve following questions (Use "Student.XML" file) i) Create a DOM Document Object and load thisXML file ii) Get the output of this Document to the browser. Write a script to print the names of the student Present in "Student.XML" file.

https://bcapractical2017.blogspot.com/2022/05/advance-php-slip2b-write-script-to.html

  j) Write a PHP Script to display server information in table format (Use $_SERVER).

 https://bcapractical2017.blogspot.com/2022/05/advance-php-slip2b-write-script-to.html

  k) Introspection Program

https://bcapractical2017.blogspot.com/p/advance-php2019.html-Slip2

 l)Interface Program

https://bcapractical2017.blogspot.com/2022/05/advance-php-slip7a-define-interface.html