Php Programs

download Php Programs

of 34

  • date post

    06-Apr-2018
  • Category

    Documents

  • view

    220
  • download

    0

Embed Size (px)

Transcript of Php Programs

  • 8/3/2019 Php Programs

    1/34

    Name of the Program1: ex1.html

    Structures and Functions first page

    X value:

    N value:

    Addition table

    Multiplication table

    Division table

    Subtraction table

    Name of the Program1: php1.php

  • 8/3/2019 Php Programs

    2/34

    function add( $x, $n )

    {

    echo "Addition Table
    ";

    for ($i = 1; $i

  • 8/3/2019 Php Programs

    3/34

    echo "Subtraction Table
    ";

    for ($i = 1; $i

  • 8/3/2019 Php Programs

    4/34

    Output for ex1.html: Output for php1.php

  • 8/3/2019 Php Programs

    5/34

    Name of the Program2: ex2.html

    Login

    Login Form

    User Name

    Pass Word

    Click here if want skip Login

    Name of the Program2: php2_page2.php

    PAGE 2#

    Welcome to Php

    This Page print the user name and password from the previous page

    Using Query String method...........

  • 8/3/2019 Php Programs

    6/34

    ?>

    Name of the Program2: php2_page3.php

    PAGE 3#

    Welcome to Php

    This Page print the user name and password from the previous page

    Using POST method...........

  • 8/3/2019 Php Programs

    7/34

    Output for ex2.html:

    php2_page2.php

  • 8/3/2019 Php Programs

    8/34

    Output for ex2.html:

    Output for php2_page3.php

  • 8/3/2019 Php Programs

    9/34

    Name Of the Program3:ex3.html

    Resume Preparation

    First Name

    Last Name

    Address

    Email ID

    Mobile

    Father's Name

    Date Of Birth

    Marital Status

    Educational Qualification

    DegreeInstitutionYear Of

    PassMarks(%)

  • 8/3/2019 Php Programs

    10/34

    Name Of Program3:php3.php

  • 8/3/2019 Php Programs

    11/34

    echo "Father's Name ",ucwords($_POST['faname'])."

    ";

    echo "Date Of Birth ",$_POST['dob']."

    ";

    echo "Marital Status ",strtolower($_POST['mstatus'])."

    ";

    $qual=array("Degree"=>$_POST['degree'],"Institution"=>$_POST['inst'],"YearOfP

    ass"=>$_POST['yop'],"Marks"=>$qual[3]=$_POST['marks']);

    echo "DegreeInstitutionYear Of

    PassMarks(%)";

    echo "".$qual["Degree"]."";

    echo "".$qual["Institution"]."";

    echo "".$qual["YearOfPass"]."";

    echo "".$qual["Marks"]."";

    ?>

  • 8/3/2019 Php Programs

    12/34

    output for ex3.html

    Output for php3.php

  • 8/3/2019 Php Programs

    13/34

    Name Of the Program4:ex4.php

    Select Name of the Field to Sort

    sname

    m1

    m2

    tot

    avg

    ASC

    DESC

  • 8/3/2019 Php Programs

    14/34

    while($row=mysql_fetch_array($result))

    {

    echo "".$row['sname']."";

    echo "".$row['m1']."";

    echo "".$row['m2']."";

    echo "".$row['tot']."";

    echo "".$row['avg']."";

    echo "";

    }

    echo "";

    mysql_close($connection);

    ?>

  • 8/3/2019 Php Programs

    15/34

    Output for ex4.php

  • 8/3/2019 Php Programs

    16/34

    Name Of the Program5 :application.html

    application

    College Application

    Candidate Name

    Father's Name

    Date Of Birth

    Gender FemaleMale

    Community oc/fc

    bc/mbcsc/st

    Religion

    hindu

    muslim

    christion

    Nationality

    indian

    pakisthan

    Address

  • 8/3/2019 Php Programs

    17/34

    Qualification

    Inst

    YOJ

    Major

    YOP

    Marks

    Offering Courses

    BCA

    B.Sc(I.T)

    B.Sc(C.S)

  • 8/3/2019 Php Programs

    18/34

    Name Of the Program5:application.php

    college application form

    congradulation!...

    you application register successfully.

  • 8/3/2019 Php Programs

    19/34

    Output for application.html

    Output for application.php

  • 8/3/2019 Php Programs

    20/34

    Name of the program6 :ex6.php

  • 8/3/2019 Php Programs

    21/34

    Output1 for ex6.php: Parser Functions

  • 8/3/2019 Php Programs

    22/34

    Name of the Program7: ex7.php

    Regular Expression

    Enter Your Name

    Enter Your E-Mail ID

    Enter Your Fav Color

    Enter Date(yyyy-mm-dd)

  • 8/3/2019 Php Programs

    23/34

    {

    if (preg_match($pattern,$email))

    echo "
    Entered Email Format is Correct
    ";

    else

    echo "
    Entered Email Format is Not match
    ";

    }

    if(isset($_POST[t3]))

    {

    $pattern = '/^#(([a-fA-F0-9]{3}$)|([a-fA-F0-9]{6}$))/';

    $color = $_POST[t3];

    if (preg_match($pattern,$color))

    echo "
    Entered Color Format is Correct
    ";

    else

    echo "
    Entered Color Format is Not match
    ";

    }

    if(isset($_POST[t4]))

    {

    echo "Your Entered Date is (mm/dd/yyyy)";

    echo preg_replace("/(\d+)-(\d+)-(\d+)/", "$2/$3/$1", $_POST[t4]);

    }

    ?>

  • 8/3/2019 Php Programs

    24/34

    Output1 for ex7.php: Regular Expression Validation

    Output2 for ex7.php: Regular Expression Validation

  • 8/3/2019 Php Programs

    25/34

    Name of the Program8: ex8.php

  • 8/3/2019 Php Programs

    26/34

    Output1 for ex8.php :Network , file system , date time functions

  • 8/3/2019 Php Programs

    27/34

    Name of the Program9: ex9.html

    Lab Ex 10

    Saving and Retrieving the Session Information

    Name of the Variable to Store Information

    Enter Information To Store

    Enter the time, how long to store

    Do You want Save

    Retrieve

  • 8/3/2019 Php Programs

    28/34

    Name Of the Program9: sess.php

  • 8/3/2019 Php Programs

    29/34

    Output1 for ex9.html: Saving and Retrieving Session Information

    Output2 for ex9.html: Saving and Retrieving Session Information

  • 8/3/2019 Php Programs

    30/34

    Output3 for ex9.html: Saving and Retrieving Session Information

    Output4 for ex9.html: Saving and Retrieving Session Information

  • 8/3/2019 Php Programs

    31/34

    Name Of the Program10 : ex10.html

    Lab Ex 10

    Session Info and Cookie Information

    Name of the Variable to Store Information

    Enter Information To Store

    Enter the time, how long to store

    Do You want Increment

    Decrement

    Session Variable

    Cookie Variable

  • 8/3/2019 Php Programs

    32/34

    Name Of the Program10: sess_cookie.php

  • 8/3/2019 Php Programs

    33/34

    Output for ex10.html

    Output for sess_cook.php

  • 8/3/2019 Php Programs

    34/34

    Output for ex10.html

    Output for cookie: