Final Php Report Manmohan

Embed Size (px)

Citation preview

  • 8/18/2019 Final Php Report Manmohan

    1/56

      HTML, PHP & MySQLA

    Industrial Training Report

    Submitted in partial fulfillment of the requirement for the award of Degree of 

    B.Com(Computer Application)

    BARKATULLAH UI!"RSIT#

    BH$%AL &'(%)

    Submitted ByShubham *hous+e,

    -.-/010-

    Department $f *omputer Appli2ation

    ' K %onda *ollege of Business an 'anagement

    Bhopal( 'ar2h3April &40-5)

  • 8/18/2019 Final Php Report Manmohan

    2/56

    Certifcate

    Date6-5708740-5

    %la2e6Bhopal

    T !HM S "#"$ %T MA C'C"$'

    This is to 2ertif, that Subham *hous+e, has 2ompleted the Industrial Training in

    our $rgani9ation Cybercop %no Solution, B*opal (M.P.) during the a2ademi2

    year +-/+-0( He7she was trained in the field of 12/HTML, PHP & M SQL3.

    His o:erall performan2e during the period was good( ;e wish him great su22ess in

    future(

      &IT 'anager)

    Cyber cop %no Solution, B*opal

  • 8/18/2019 Final Php Report Manmohan

    3/56

    D"*LARATI$

      I Anand Dangi Son o Mr.Umed Singh

    Dangi certiy that the internship reportentitled “ ”. Website development repaired by

    me is my personal and an authentic work under the

    guidance o Mr.Ranjeet kumarI! "anager# o

    Cyber Cops Ino Solution$%hopal.

    &ate'(

    Signature o student

      )lace'(%hopal *ame'(+*+*& &+*,I

      Class'(

    %.com -th SemC+#

      +ddress'()ooa Colony

    /arond %hopal#

    Contact *o.'(

    0-11233454 

  • 8/18/2019 Final Php Report Manmohan

    4/56

    AC4'!L"56"M"'T

    Before< we get into the depth of the things we would li+e to add heartfelt words for the

     people who at :arious stages of the pro=e2t de:elopment helped us b, their :aluable

    guidan2e(

    ;e ta+e this opportunit, to e>press our deep sense of gratitude and indebtedness to

    M  Rajinder kaur, Computer Science Department of our 2ollege< for his 2ontinuous

    guidan2e< support and en2ouragement throughout the 2ourse of this entire pro=e2t(

    This di2tion is nothing to a2+nowledge the 2onstant inspiration en2ouragement andguided b, Mr $an7eet  Kumar, the pro=e2t guide< ?M 4 Ponda Colle8e o Buine

    and Mana8ement, B*opal9< Bhopal for empowering us to 2omplete our pro=e2t( It was

     onl, due to their sin2ere effort that we were able to end up this pro=e2t(

    Also a spe2ial than+s to all other staff members and 2olleagues for their help and

    suggestion< whi2h the, ha:e alwa,s towards us whene:er we were in trouble(

    Last but not the least we would li+e to e>press our gratitude to our parents without

    whose help and blessings we 2an@t ta+e a single step in the right dire2tion(

    T*an:;

  • 8/18/2019 Final Php Report Manmohan

    5/56

    INDEX

    S.no.

    Content Page

    1  A glance of Internship

    Detail

    2 Internship Schedule

    3  About the organization

     Area of internship

    ! Internship Activities

    "  An assessment of the

    Internship

    # Conclusion

    $ References

  • 8/18/2019 Final Php Report Manmohan

    6/56

    A glan2e at internship Detail

     ame of student 6 Shubham 2hou+se,

    %ermanent Address 6 2handpur andhi nagar &Bhopal)

    Address for 2orresponden2e 6 2handpur andhi nagar &Bhopal)

    *onta2t o( 6 C1C44.1/1

    Student "mail Address 6 s2hou+se,45gmail(2om

    $rgani9ation ame 6 2,ber2ops pri:ate limited

    $rgani9ation Address 6 *34/< Eirst Eloor< indrapuri< Bhopal

      &'(%()

    $rgani9ation 2onta2t o( 6 6722 160 5500

    $rgani9ation website 6 6 www(2,ber2opsinfosolution(2om

     ame of instru2tor 6 'r(Ran=eet +umar 

    Area of internship 6 web Designing

    Internship duration 6/ =an(40-5

    *ompletion Date 6-1 feb(40-5

     umber of internship da,s 6 ./ da,s

    http://www.cybercopsinfosolution.com/http://www.cybercopsinfosolution.com/

  • 8/18/2019 Final Php Report Manmohan

    7/56

    I*!89*S:I) SC:8&;$

    :ori?ontal rule tag=hr>Comments and "ar@uee tag

     THIRD WEEK :!"< styling tag$ :!"< CSS:!"< !eAt ormatting$ :!"<

  • 8/18/2019 Final Php Report Manmohan

    8/56

     WEEK &elete Fuery

    +bout the Ergani?ation

    CMPA' P$

  • 8/18/2019 Final Php Report Manmohan

    9/56

    *,ber2ops Info Solution offers a wide range of etwor+ing *ourses and Trainings

    from top *omputer %rogramming and etwor+ing 2ompanies su2h as $ra2le< *is2o

    S,stems< 'i2rosoft< Linu>< *he2+%oint< et2 to help students and %rofessionals to

    de:elop a deep understanding into the wor+ings of software de:elopment and

    Internetwor+s and also helping them su22essfull, passing etwor+ing industr,Fs

    leading *ertifi2ations li+e $*G%

  • 8/18/2019 Final Php Report Manmohan

    10/56

     

    Area o% intern&hi'(E) SI*E+ Web site is a related collection o World Wide Web WWW# fles thatincludes a beginning fle called a home page. + company or anindividual tells you how to get to their Web site by giving you theaddress o their home page. Brom the home page$ you can get to allthe other pages on their site. Bor eAample$ the Web site or I%" hasthe home page address o http'GGwww.ibm.com. !he home page

    address actually includes a specifc fle name like index.html but$ asin I%"Hs case$ when a standard deault name is set up$ users donHthave to enter the fle name.# I%"Hs home page address leads tothousands o pages. %ut a Web site can also be ust a ew pages.#

    *(+ *,PES +- (E)SI*ES

    1.Static =ebite+ static website is one that has web pages stored on the server inthe ormat that is sent to a client web browser. It is primarily coded in:yperteAt "arkup

  • 8/18/2019 Final Php Report Manmohan

    11/56

    are available or general(use programming languages like )erl$ ):)$)ython and 9uby to make it aster and easier to create compleAdynamic web sites.

    IN*R+DUC*I+N +- *M4

    )ui5ding Stati0 Site& through *M4

    :!"< is a computer language devised to allow website creation. !hese websites can then be viewed by anyone else connected to theInternet. It is relatively ea&/ to 5earn and @uite powerul in what itallows you to create. It is constantly undergoing revision andevolution to meet the demands and re@uirements o the growingInternet audience under the direction o the N W5C$ the organi?ation

    charged with designing and maintaining the language.

    *he de6nition o% *M4 i& /'er *e7t Marku' 4anguage.:yperteAt is the method by which you move around on the web O byclicking on special teAt called hyperlinks which bring you to the neAtpage. !he act that it is hyper ust means it is not linear O i.e. youcan go to any place on the Internet whenever you want by clickingon links O there is no set order to do things in.

    "arkup is what :!"< tags do to the teAt inside them. !hey mark it as a certain type o teAt italici?ed teAt$ or eAample#.

    :!"< is a

  • 8/18/2019 Final Php Report Manmohan

    12/56

    stuJ$ ust by telling your browser what to render on the page.

    &iJerent tags will perorm diJerent unctions. !he tags themselves

    donRt appear when you view your page through a browser$ but their

    eJects do. !he simplest tags do nothing more than apply ormatting

    to some teAt$ like this'

    =b>these words will be bold=Gb>$ and these will not.

    ITR$DU*TI$ $E %H%

    PP (hat i& it8

     !aken directly rom ):)Hs home$ ):).net$ K):) is an :!"

  • 8/18/2019 Final Php Report Manmohan

    13/56

    • PHP supports a wide range of data$ases

    • PHP is free% .ownload it from the official PHP resource: www%php%net

    • PHP is easy to learn and runs efficiently on the server side

    PP (hat9& it do8

    It is also helpul to think o ):) in terms o what it can do or you.):) will allow you to'

    T 9educe the time to create large websites.

    T Create a customi?ed user eAperience or visitors based oninormation that you have gathered rom them.

    T Epen up thousands o possibilities or online tools. Check out

    ):) ( :otScripts or eAamples o the great things that arepossible with ):)

    T +llow creation o shopping carts or e(commerce websites.

    PP : S/nta7%eore we talk about ):)Hs syntaA$ let us frst defne what syntaA isreerring to.

    SyntaA ( !he rules that must be ollowed to write properly structured

    code.

    ):)Hs syntaA and semantics are similar to mostother programming languages C$ Mava$ )erl# with the addition that all):) code is contained with a tag$ o sorts. +ll ):) code must becontained within the ollowing...

    %'T$5>T%' < M SQL

      "y SF< is currently the most popular open source

    database server in eAistence. En top o that$ it is very commonly

    used in conunction with ):) scripts to create powerul and dynamic

    server(side applications.

    (hat i& a dataa&e8

    http://www.php.net/http://www.php.net/

  • 8/18/2019 Final Php Report Manmohan

    14/56

      + database is a structure that comes in two

    Lavors' a Lat database and a relational database. + relational

    database is much more oriented to the human mind and is oten

    preerred over the gabble(de(gook Lat database that are ust stored

    on hard drives like a teAt fle. "y SF< is a relational database.

    (h/ u&e a Dataa&e8

    &atabases are most useul when it comes to storing

    inormation that fts into logical categories. Bor eAample$ say that you

    wanted to store inormation o all the employees in a company. With

    a database you can group diJerent parts o your business into

    separate tables to help store your inormation logically.

    M/ S;4 0onne0t

    %eore you can do anything with "y SF< in ):) you

    must frst establish a connection to your web hostHs "y SF<

    database. !his is done with the "y SF< connect unction.

    mys@lUconnect#

    S/nta7

    mys@lUconnectKserverK$ KuserK$ KpasswordK#

  • 8/18/2019 Final Php Report Manmohan

    15/56

    INTERNSHIP ACTIVITIES

    HTML

    *M4 marku' tag& are u&ua55/ 0a55ed *M4 tag&

    (:!"< tags are keywords surrounded by ang5e ra0ket& like=html> (:!"< tags normally 0ome in 'air& like =b> and =Gb> (!he frst tag in a pair is the &tart tag

  • 8/18/2019 Final Php Report Manmohan

    16/56

    E7ten&ion 8When you save an :!"< fle$ you can use either the

    .htm or the .html eAtension. We use .htm in our eAamples.

    With new sotware it is perectly sae to use .html

    Under&tand the *M4 (e Page Stru0ture.

    =html>=body>:ello$:ow are you.

    =Gbody>=Ghtml>

    E7am'5e E7'5ained

    T !he teAt between =html> and =Ghtml> describes the web pageT !he teAt between =body> and =Gbody> is the visible page

    content

     !his is the common structure o all the :!"< Web )ages.

    +lways you have to Start the :!"< )age with opening :!"< and

    %ody !ags =html> and =body> and ater putting all the content you

    need in the Web )age$ Qou need to close the opened tags by

    =Gbody> and =Ghtml>$ in the order they were opened.

    *M4 E5ement&.+n :!"< element is everything rom the start tag to the end tag.I55u&tration=p>!his is Some Content.=Gp>

    I55u&tration E7'5ained:ere everything or start paragraph tag to end tag is the :!"<8lement. !he content between the tags “!his is Some Content.” is

    known as the element content.

    *M4 E5ement S/nta7T +n :!"< element starts with a &tart tag ? o'ening tag.T +n :!"< element ends with an end tag ? 05o&ing tag.T !he e5ement 0ontent is everything between the start and the

    end tag.

  • 8/18/2019 Final Php Report Manmohan

    17/56

    T Some :!"< elements have em't/ 0ontent.T 8mpty elements are 05o&ed in the &tart tag.T "ost :!"< elements can have attriute&.

    *M4 )a&i0 *ag& E7'5ained. eading *ag&

     !here are siA levels o headings in HTML specifed by =H1>$

    =:4>$ =:5>$ =:1>$ =:2> and =:->tags. =h> defnes the largest

    heading and =h-> defnes the smallest heading.

    Paragra'h *ag I55u&tration E7'5ained  :!"< )aragraph element are defned with the =p> tags.

    +lways remember to close the paragraph tag when a particular

    paragraph is written completely.

    I55u&tration

    =html>

    =body>

    =a hreXKhttp'GGwww.cybercopsinosolution.comK>Cybercops InoSolution :ome )age.=Ga>

    =Gbody>=Ghtml>

  • 8/18/2019 Final Php Report Manmohan

    18/56

    I55u&tration +ut'ut

    Cybercops Ino Solution :ome )age.

    Some other U&e%u5 *ag&.

    We will now discuss some other useul tags like :!"< 9ules$ :!"<

    Comments$ :ori?ontal 9ule# is a stand alone tag that generates a

    hori?ontal line. !here is no corresponding HTML command or a

    vertical line.

    I55u&tration=html>

    =body>

    =h>"y Birst :eading.=Gh>

    =hr>

    =h4>"y Second :eading.=Gh4>

    =Gbody>=Ghtml>

    I55u&tration +ut'ut.

    Ru5e& *ag I55u&tration E7'5ained !he =hr> !ag generates a hori?ontal line between the 4 :eadings.

    *M4 Comment&

  • 8/18/2019 Final Php Report Manmohan

    19/56

    All 2ombinations of te>t pla2ed within the comment tags will be ignored b, the web

     browser< this in2ludes an, HTML tags< s2ripting language&s)< et2( *omment tags 33

    and 33J are used to insert 2omments in HT'L%

    E7am'5e

    =(( Write your comments here ((>

    4ine )reak&

     !o break the line and move to the neAt line. ;se the =br> tag.

    Mar@uee

    n HTM mar/uee is a scrolling piece of text displayed either hori0ontally across or

    vertically down your we$page depending on the settings% This is created $y using

    HTM 1mar/uees2 tag%

    =&EC!Q)8 html>

    =html>

    =head>

    =title>:!"< mar@uee !ag=Gtitle>

    =Ghead>

    =body>

    =mar@uee>!his is basic eAample o mar@uee=Gmar@uee>

    =mar@uee directionXKupK>!he direction o teAt will be rom bottomto top.=Gmar@uee>

    =Gbody>

    =Ghtml>

    *M4 St/5ing *ag&

     Qou may want to change the way the generated

    :!"< output looks. !he best way to do that is with a Cascading StyleSheet CSS#$ which modern browsers support. Bont amily$ type si?e$colors$ and other styles can be controlled with CSS or each kind o element.

    Conne0t CSS to a (e'age

  • 8/18/2019 Final Php Report Manmohan

    20/56

    Insert the link o CSS Biles into the :!"< fle. !he link is to be put inthe =:8+&> element.

    I55u&tration

    =link relXKstylesheetK hreXKstylesheet.cssK typeXKteAtGcssK>

    I55u&tration E7'5ained !he above tag$ links the CSS fle named

    “stylesheet.css” to the current Web page.

    St/5ing *M4 ith CSS

    CSS stands or Cascading Style Sheets

    Styling can be added to :!"< elements in 5 ways'

    T Inline ( using a &t/5e attriute in :!"< elements

    T Internal ( using a &t/5eB e5ement in the :!"< =head>

    section

    T 8Aternal ( using one or more e7terna5 CSS 65e&

    CSS S/nta7

    element  Y property 'value; property:value }

    In5ine St/5ing In5ine CSS

    Inline styling is useul or applying a uni@ue style to a single :!"<

    element'

    Inline styling uses the style attribute.

     !his inline styling changes the teAt color o a single heading'

    E7am'5e

    =h styleXKcolor'blueK>!his is a %lue :eading=Gh>

    Interna5 St/5ing Interna5 CSS

  • 8/18/2019 Final Php Report Manmohan

    21/56

    n internal style sheet can $e used to define a common style for all HTM elements

    on a page%

    Internal styling is defined in the  section of an HTM page, using

    a  element:

    =&EC!Q)8 html>

    =html>=head>

    =style>

    body Ybackground(color'lightgreyZ

    h Ycolor'blueZ

    p Ycolor'greenZ

    =Gstyle>

    =Ghead>

    =body>

    =h>!his is a heading=Gh>

    =p>!his is a paragraph.=Gp>

    =Gbody>

    =Ghtml>

    E7terna5 St/5ing E7terna5 CSS

    8Aternal style sheet are ideal when the style is applied to many

    pages.

    With eAternal style sheets$ you can change the look o an entire web

    site by changing one fle.

    E7terna5 &t/5e& are defned in an eAternal CSS fle$ and then linked

    to in the headB section o an :!"< page'

    =&EC!Q)8 html>

    =html>

    =head>

      =link relXKstylesheetK hreXKstyles.cssK>

    =Ghead>

  • 8/18/2019 Final Php Report Manmohan

    22/56

    =body>

    =h>!his is a heading=Gh>

    =p>!his is a paragraph.=Gp>

    =Gbody>

    =Ghtml>

    *e7t -ormatting

    :!"< also defnes special e5ement&$ or defning teAt with

    a special meaning.

    :!"< uses elements like =b> and =i> or ormatting output$

    like o5d or italic teAt.

    Bormatting elements were designed to display special t/'e& o% te7t'

    • 3old text

    • mportant text

    • talic text

    • 4mphasi0ed text

    • Mar5ed text

    • mall text

    • .eleted text

    • nserted text

    • u$scripts

    • uperscripts

    *M4 4ink&

    :!"< links are useul to interconnected the :!"< pages.

  • 8/18/2019 Final Php Report Manmohan

    23/56

    + hyperlink is a teAt or an image you can click on$ and ump to

    another document.

    n HTM, lin5s are defined with the  tag:

    S/nta7

    =a hreXKurlK>link text =Ga>

    E7am'5e

    =a hreXKhttp'GGcybercopsinosolutionsK>isit our :!"< tutorial=Ga>

    *M4 *a5e *ag&

      !he =table> tag defnes an :!"< table. + simple

    :!"< table consists o the table element and one or more tr$ th$ and

    td elements. !he tr element defnes a table row$ the th element

    defnes a table header$ and the td element defnes a table cell.

    E7am'5e

    =&EC!Q)8 html>

    =html>

    =body>

    =table borderXKK styleXKwidth'66[K>

    =tr>

    =td>Mill=Gtd>

    =td>Smith=Gtd>

    =td>26=Gtd>

  • 8/18/2019 Final Php Report Manmohan

    24/56

    =Gtr>

    =tr>

    =td>8ve=Gtd>

    =td>Mackson=Gtd>

    =td>01=Gtd>

    =Gtr>

    =tr>

    =td>Mohn=Gtd>

    =td>&oe=Gtd>

    =td>36=Gtd>

    =Gtr>

    =Gtable>

    =Gbody>

    =Ghtml>I55u&tration +ut'ut.

    *M4 4i&t *ag&

    Words or phrases which need to be set apart rom the rest o thebody o teAt can be emphasi?ed with a “bullet”.

    4i&t *ag

    4IB' creates a bullet in ront o teAt which is to be set apart or

    emphasis and causes all teAt ater it to be indented$ either until

  • 8/18/2019 Final Php Report Manmohan

    25/56

    another list tag is detected or until the end o the list is reached. It is

    used to itemi?e elements o “unordered” and “ordered” lists.

    Unordered 4i&t

    +n unordered list is a list o items. !he list items are marked with

    bullets typically small black circles#.

    +n unordered list starts with the =ul> tag. 8ach list item starts with

    the =li> tag.

    I55u&tration

    =html>

    =body>

    =ul>=li>Manuary=Gli>

    =li>Bebruary=Gli>=Gul>

    =Gbody>=Ghtml>

    I55u&tration +ut'ut

    Unordered 4i&t I55u&tration E7'5ained

     Manuary D Bebruary are put in %ullet as they are inside

    an =ul> unordered list tags.

    +rdered 4i&t

    +n ordered list is also a list o items. !he list items are marked with

    numbers. +n ordered list starts with the =ol> tag. 8ach list item

    starts with the =li> tag.

    I55u&tration

  • 8/18/2019 Final Php Report Manmohan

    26/56

    =html>

    =body>

    =ol>=li>Manuary=Gli>

    =li>Bebruary=Gli>=Gol>

    =Gbody>=Ghtml>

    I55u&tration +ut'ut

    De&igning *M4 -orm&

    + orm is an area that can contain orm elements. Borm elements are

    elements that allow the user to enter inormation like teAt felds$

    teAtarea felds$ drop(down menus$ radio buttons$ checkboAes$ etc.# in

    a orm. + orm is defned with the =orm> tag.

    =&EC!Q)8 html>

    =html>

    =body>

    =orm actionXKactionUpage.phpK>

      Birst name'=br>

    =input typeXKteAtK nameXKfrstnameK valueXK"ickeyK>

    =br>

     

  • 8/18/2019 Final Php Report Manmohan

    27/56

    =br>=br>

    =input typeXKsubmitK valueXKSubmitK>

    =Gorm>

    =p>I you click the KSubmitK button$ the orm(data will be sent to a

    page called KactionUpage.phpK.=Gp>

    =Gbody>

    =Ghtml>

    I55u&tration +ut'ut

    *e7t6e5d

     !eAt felds are used when you want the user to type letters$ numbers$

    etc. in a orm.

    Raadio )utton

    9adio %uttons are used when you want the user to select one o a

    limited number o choices.

  • 8/18/2019 Final Php Report Manmohan

    28/56

    Che0ko7

    CheckboAes are used when you want the user to select one or moreoptions o a limited number o choices.

    )5o0k5e>e5 E5ement&+ block(level element always starts on a new line and takes up theull width available stretches out to the let and right as ar as itcan#.

    8Aamples o block(level elements'

    T =div>

    T =h> ( =h->

    T =p>

    T =orm>

    In5ine E5ement&

    +n inline element does not start on a new line and only takes up as

    much width as necessary.

     !his is an inline =span> element inside a paragraph.

    (hat are di>B *ag&

     !he =div> tag in \:!"< is a tag that defnes logical

    divisions within the content o a page. What this means is that a

    =div> tag defnes sections o a Web page to make it easier to

    manage$ style$ and manipulate.

  • 8/18/2019 Final Php Report Manmohan

    29/56

    =div idX”frst”>:ello !here=Gdiv>

    E7am'5e

      

      This div tag

        

      contains this div tag.

        

      

    I55u&tration +ut'ut

    di>B *ag I55u&tration E7'5ained

    We can then give any design or position to the easily to the =div>

    using the CSS.

    *M4 Image&

    In :!" tag is empty$ it contains attributes only$ and does not

    have a closing tag.

     !he src attribute specifes the ;9< web address# o the image'

    =img srcXKurlK altXKsome text K>

    *he a5t Attriute

      !he alt attribute specifes an alternate teAt or an image$ i

    the image cannot be displayed.

  • 8/18/2019 Final Php Report Manmohan

    30/56

     !he alt attribute provides alternative inormation or an image i a

    user or some reason cannot view it because o slow connection$ an

    error in the src attribute$ or i the user uses a screen reader#.

    =img srcXKimage.giK altXK:!"

    PP Code

    =]php

     ]>

    or the shorthand ):) tag that re@uires shorthand support to be

    enabled

    on your server...=]

    o to Sa>e PP Page&8

    I you have ):) inserted into your :!"< and want the web browser

    to interpret it correctly$ then you must save the fle with a .php

    eAtension$ instead o the standard .html eAtension. So be sure to

    check that you are saving your fles correctly.

    PP Code

    =html>

    =head>

    =title>"y Birst ):) )age=Gtitle>

    =Ghead>

    =body>

    =]php

    echo K:ello WorldK ]>

    =Gbody>

  • 8/18/2019 Final Php Report Manmohan

    31/56

    =Ghtml>Di&'5a/

    :ello World

    (hite S'a0e

    +s with :!"

    =head>

    =title>"y Birst ):) )age=Gtitle>

    =Ghead>

    =body>

    =]php

    echo K:ello WorldK

    echo K:ello WorldK ]>

    =Gbody>

    =Ghtml>

    Di&'5a/

    :ello World :ello World

    PP aria5e&

      + variable is a means o storing a value$ such asteAt string K:ello WorldK or the integer value 1. + variable can then

  • 8/18/2019 Final Php Report Manmohan

    32/56

    be reused throughout your code$ instead o having to type out theactual value over and over again.

    In ):) you defne a variable with the ollowingorm'

    T ^variableUname X alue

    I you orget that dollar sign at the beginning$ it will not work. !his isa common mistake or new ):) programmers

    PP aria5e Naming Con>ention& !here are a ew rules that you need to ollow when choosing a nameor your ):) variables.( ):) variables must start with a letter or underscore KUK.

    ( ):) variables may only be comprised o alpha(numeric charactersand underscores. a(?$ +(_$ 6(0$ or

    ( ariables with more than one word should be separated withunderscores. ^myUvariable

    ( ariables with more than one word can also be distinguished withcapitali?ation. ^myariable

    PP :De0i&ion Making&ecision making statement in ):) are used to take some

    decision the ):) script.Sometime it is re@uired to perorm some task based on condition atthat time decision making statements are used.

    &ecision making statements allow you to control eAecution o certainpart o the code based on the outcome o the condition at run time.

    ):) supports ollowing decision making statements'

    T Simple I Statement

    T I`else StatementT *ested I statementT I`elsei

  • 8/18/2019 Final Php Report Manmohan

    33/56

    T i%...e5&e &tatement  use this statement i you want to

    eAecute a set o code when a condition is true and another i 

    the condition is not true

    T e5&ei% &tatement  is used with the i...else statement to

    eAecute a set o code i one o the several condition is true

    T &it0h &tatement  is used i you want to select one o many

    blocks o code to be eAecuted$ use the Switch statement. !he

    switch statement is used to avoid long blocks o i..elsei..else

    code.

    PP E0ho

    +s you saw in the previous lesson$ the ):) unction echo is a means

    o outputting teAt to the web browser. !hroughout your ):) career

    you will be using the echo unction more than any other. So letHs give

    it a solid perusal

  • 8/18/2019 Final Php Report Manmohan

    34/56

    +ut'utting a String

     !o output a string$ like we have done in previous lessons$ use the ):)

    echo unction. Qou can place either a string variable or you can use

    @uotes$ like we do below$ to create a string that the echo unction will

    output.

    PP Code

    =]php

     ^my String X K:elloK

    echo ̂ my String

    echo K=h2>I love using ):)=Gh2>K

    ]>

    Di&'5a/

    :ello

    I love using ):)

    Care%u5 (hen E0hoing ;uote&F

    It is pretty cool that you can output :!"< with ):). :owever$ you

    must be careul when using :!"< code or any other string that

    includes @uotes !he echo unction uses @uotes to defne the

    beginning and end o the string$ so you must use one o the ollowing

    tactics i your string contains @uotations'

    &onHt use @uotes inside your string

     8scape your @uotes that are within the string with a slash. !o escape

    a @uote ust place a slash directly beore the @uotation mark$ i.e. K

    ;se single @uotes apostrophes# or @uotes inside your string.

    See our eAample below or the right and wrong use o the echounction'

  • 8/18/2019 Final Php Report Manmohan

    35/56

    PP Code

    =]php

     GG !his wonHt work because o the @uotes around special:2

    echo K=h2 classXKspecial:2K>I love using ):)=Gh2>K

    GG E/ because we escaped the @uotes

    8cho K=h2 classXKspecial:2K>I love using ):)=Gh2>K

    GG E/ because we used an apostrophe H

    8cho K=h2 classXHspecial:2H>I love using ):)=Gh2>K

    ]>

    PP String&

    In the last lesson$ ):) 8cho$ we used strings a bit$ but didnHt talk

    about them in depth. !hroughout your ):) career you will be using

    strings a great deal$ so it is important to have a basic understanding

    o ):) strings.

    I55u&tration

    =]php

      ^variable X KnameK

      ^literally X H"y ^variable will not printnH

    print^literally#

    print K=br G>K

      ^literally X K"y ^variable will printnK

    print^literally#

  • 8/18/2019 Final Php Report Manmohan

    36/56

    ]>

    I55u&tration +ut'ut

    PP String Creation

    %eore you can use a string you have to create it + string can be

    used directly in a unction or it can be stored in a variable.

    Cookie&

    ):) transparently supports :!!) cookies. Cookies are a mechanism

    or storing data in the remote browser and thus tracking or

    identiying return users. Qou can set cookies using the &et0ookieor &etra0ookie unction.

    Cookies are teAt fles stored on the client computer and they are

    kept o use tracking purpose. ):) transparently supports :!!)

    cookies.

     !here are three steps involved in identiying returning users

    T Server script sends a set o cookies to the browser. Bor eAample

    name$ age$ or identifcation number etc.

    T %rowser stores this inormation on local machine or uture use.

    T When neAt time browser sends any re@uest to web server then

    it sends those cookies inormation to the server and server uses

    that inormation to identiy the user.

    Setcookiename$value$eApire$path$domain$security#

    :ere is the detail o all the arguments

  • 8/18/2019 Final Php Report Manmohan

    37/56

    T Name !his sets the name o the cookie and is stored in an

    environment variable called :!!)UCEE/I8U+9S. !his variable

    is used while accessing cookies.

    T a5ue !his sets the value o the named variable and is the

    content that you actually want to store.

    T E7'ir/ !his speciy a uture time in seconds since 66'66'66

    ,"! on st Man 076. +ter this time cookie will become

    inaccessible. I this parameter is not set then cookie will

    automatically eApire when the Web %rowser is closed.

    T Path !his specifes the directories or which the cookie is

    valid. + single orward slash character permits the cookie to be

    valid or all directories.

    T Domain !his can be used to speciy the domain name in very

    large domains and must contain at least two periods to be

    valid. +ll cookies are only valid or the host and domain which

    created them.

    T Se0urit/  !his can be set to to speciy that the cookie

    should only be sent by secure transmission using :!!)S

    otherwise set to 6 which mean cookie can be sent by regular

    :!!).

    PP( Se&&ion&

    +n alternative way to make data accessible across the various pages

    o an entire website is to use a ):) Session.

  • 8/18/2019 Final Php Report Manmohan

    38/56

    + session creates a fle in a temporary directory on the server

    where registered session variables and their values are stored.

     !his data will be available to all pages on the site during that

    visit.

    Starting a PP Se&&ion&

    + ):) session is easily started by making a call to the sessionUstart#

    unction.

     !his unction frst checks i a session is already started and i none

    is started then it starts one. It is recommended to put the call to

    sessionUstart# at the beginning o the page.

    =]php

    sessionUstart#

    i isset ^US8SSIE*HcounterH##

    Y

      ^US8SSIE*HcounterHVX

    Zelse

    Y

      ^US8SSIE*HcounterHX

    Z

      ^msgXKQou have visited this page K.  ^US8SSIE*HcounterH

      ^msg.XKin this session.K

    ]>

    =html>

    =head>

  • 8/18/2019 Final Php Report Manmohan

    39/56

    =title>Setting up a ):) session=Gtitle>

    =Ghead>

    =body>

    =]php echo  ^msg#]>

    =Gbody>

    =Ghtml>

    +ut'ut

      Qou have visited this page in this session.

    PP =E* G P+S* Method&

    While dealing with the orms$ inormation can be submitted and

    transerred to same or another page. !o send submitted data through

    orm$ one can use ,8! D )ES! method to do that in ):).

    + orm data can be submitted using these two methods. %oth are

    used or same purpose but stands apart under some specifcations.

    +s in ,8! method key values are passed in the ;rl while in )ES!$ the

    inormation transers in a hidden manner.

    =E* Method

    +s eAplained above$ beore sending any inormation $ it converts

    valuesGdata into a @uery string in ;9< known as ;rl 8ncoding. Which

    contains both page link and encoded inormation separated by

    the ] character.

  • 8/18/2019 Final Php Report Manmohan

    40/56

    =]php

    i  ^U,8!KnameK ^U,8!KageK#

    Y

    echoKWelcome K. ^U,8!HnameH.K=br G>K

    echoKQou are K. ^U,8!HageH.K years old.K

    eAit#

    Z

    ]>

    =html>

    =body>

    =orm actionXK=]phpHPPSE4-]>K methodXK,8!K>

      *ame' =inputtypeXKteAtKnameXKnameKG>

      +ge' =inputtypeXKteAtKnameXKageKG>

    =inputtypeXKsubmitKG>

    =Gorm>

    =Gbody>

    =Ghtml>

    +ut'ut

    *ame' +ge'

    P+S* Method

      +s eAplained above$ beore sending inormation to

    server$ it converts clientRs inormation into a @uery string in ;9

  • 8/18/2019 Final Php Report Manmohan

    41/56

    Y

    i pregUmatchKG+(_a(?H(GK$^U)ES!HnameH##

    Y

    dieKinvalid name and name should be alphaK#

    Z

    echoKWelcome K. ^U)ES!HnameH.K=brG>K

    echoKQou are K. ^U)ES!HageH.K years old.K

    eAit#

    Z

    ]>

    =html>

    =body>

    =orm actionXK=]phpHPPSE4-]>K methodXK)ES!K>

      *ame' =inputtypeXKteAtKnameXKnameKG>

      +ge' =inputtypeXKteAtKnameXKageKG>

    =inputtypeXKsubmitKG>=Gorm>

    =Gbody>

    =Ghtml>

    +ut'ut

    *ame' +ge'

    PP G M/S;4 CodeJ

    =]php

  • 8/18/2019 Final Php Report Manmohan

    42/56

    mys@lUconnectKlocalhostK$ KadminK$ KadminK# or diemys@lUerror##

    echo KConnected to "ySFK

    ]>

    Di&'5a/J

    Connected to "ySF<

    Choo&ing the orking Dataa&e

    +ter establishing a "ySF< connection with the code

    above$ you then need to choose which database you will be using

    with this connection. !his is done with the mys@lUselectUdb unction.

    M/S;4 *a5e&

    + "ySF< table is completely diJerent than the normal table that you

    eat dinner on. In "ySF< and other database systems$ the goal is to

    store inormation in an orderly ashion.

    PP G M/S;4 CodeJ

    =]php

     GG "ake a "ySF< Connection

    mys@lUconnectKlocalhostK$ KadminK$ KadminK# or diemys@lUerror##

    mys@lUselectUdbKtestK# or diemys@lUerror##

    GG Insert a row o inormation into the table KeAampleK

    mys@lU@ueryKI*S89! I*!E eAample

     name$ age# +

  • 8/18/2019 Final Php Report Manmohan

    43/56

    mys@lU@ueryKI*S89! I*!E eAample

     name$ age# +

    Di&'5a/J

    &ata Inserted

    M/&@5%et0harra/J h/ u&e it8

    &o you know what is returned when you used the mys@lU@ueryunction to @uery a "ySF< database] It isnHt something you candirectly manipulate$ that is or sure. :ere is a sample S8

      !he value that mys@lU@uery returns and stores into

    ^result is a special type o data it is a "y SF< 9esource. +dditional):) unctions are re@uired to eAtract the data rom this 9esource.

    MSQL

    M/S;4 De5ete

    "aintenance is a very common task that is

    necessary or keeping "ySF< tables current. Brom time to time$ you

    may even need to delete items rom your database. Some potential

    reasons or deleting a record rom "ySF< include when' someone

    deletes a post rom a orum$ an employee leaves a company$ or

    youHre trying to destroy your records beore the ederalies come

    M/S;4 de5ete e7am'5e

  • 8/18/2019 Final Php Report Manmohan

    44/56

      !he &8

      It is important to note that this @uery would have

    deleted +

  • 8/18/2019 Final Php Report Manmohan

    45/56

    A ASS"SS'"T $E TH" IT"RSHI%

    EIRST %A"

  • 8/18/2019 Final Php Report Manmohan

    46/56

    S"*$D %A"

    THIRD %A"

  • 8/18/2019 Final Php Report Manmohan

    47/56

    E$URTH %A"

  • 8/18/2019 Final Php Report Manmohan

    48/56

    EIETH %A"

  • 8/18/2019 Final Php Report Manmohan

    49/56

    SITH %A"

  • 8/18/2019 Final Php Report Manmohan

    50/56

  • 8/18/2019 Final Php Report Manmohan

    51/56

    CONCLUSION 

    ;eb te2hnolog, has been growing da, b, da, so as networ+ing( The

    s2ope in website de:elopment has been in2reasing more in IT field(

    Toda, almost e:er, organi9ation is using website and some through

    man, networ+ing problem( ;ebsite de:elopment is a 2hallenging tas+

    for me but wor+ing under guidan2e of m, instru2tor 'r(Ran=eet +umar 

    sir made me wor+ at eas,( ;or+ing under his guidan2e ha:e made

    2onfident o:er m, sub=e2t &website designing) and made me 2apable

    of sol:ing basi2 programming problems( After all these e>perien2es

    whi2h I got m, angel software< I am loo+ing forward to 2ontinue m,

    2areer in the field of website de:elopment(

  • 8/18/2019 Final Php Report Manmohan

    52/56

    )i5iogra'h/

    1 .C Xa>ier& K*M4

    L

  • 8/18/2019 Final Php Report Manmohan

    53/56

  • 8/18/2019 Final Php Report Manmohan

    54/56

  • 8/18/2019 Final Php Report Manmohan

    55/56

  • 8/18/2019 Final Php Report Manmohan

    56/56