SlideShare a Scribd company logo
1 of 19
Download to read offline
Assigning Values To
Variables
Assigning Values To
Variables
This webpage consists of three main
parts: HTML, PHP, and CSS.
The webpage contains a form that asks
the user to enter their first name, last
name, and age. The form has a submit
button that the user can click to submit
their information. When the user submits
the form, the information is sent to a
PHP script that processes the data and
displays a message with the user's
name, age, and birth year.
The <form> tag specifies the method
used to submit the form data, which is
set to "post" using the "method"
attribute. This means that the data
entered in the form fields will be sent in
the HTTP request body, rather than
appended to the URL.
The "action" attribute specifies the URL
of the PHP script that will process the
form data when the user submits the
form.
This HTML code creates a form with
three input fields: "First Name", "Last
Name", and "Your Age". Each input field
is created with the <input> tag and has a
corresponding "name" attribute that will
be used to identify it in the PHP script.
The "size" attribute of the input fields
specifies their width in characters.
The submit button is created using an
<input> tag with the "type" attribute set
to "submit" and the "value" attribute set
to "Submit Information".
The PHP code:
This PHP code retrieves the values of
the form fields using the $_POST
superglobal array. The $_POST array
contains key-value pairs where the keys
are the "name" attributes of the form
fields and the values are the data
entered into those fields.
The PHP code then assigns these
values to variables for easier
manipulation. The $firstname,
$lastname, and $age variables
correspond to the form fields with the
same names.
The first name and last name are then
concatenated into a single string variable
called $fullname. This is achieved by
enclosing the variable names in double
quotes and separating them with a
space. The resulting string allows the
values of the variables to be inserted
into the text.
Next, the code sets the $factor variable
to 5 and adds it to the user's age to get
the $ageplus variable. This is just an
example calculation to demonstrate the
use of variables.
The code then uses the date() function
to get the current year and assigns it to
the $current_year variable. It subtracts
the $ageplus value from the
$current_year value to get the user's
birth year and assigns it to the
$birth_year variable.
Finally, the PHP code generates a
response using the print statement. It
generates an HTML paragraph (<p>)
with the user's full name, age, the
calculated age plus 5, and their birth
year.

More Related Content

Similar to 8.pdf

Html advanced-reference-guide for creating web forms
Html advanced-reference-guide for creating web formsHtml advanced-reference-guide for creating web forms
Html advanced-reference-guide for creating web forms
satish 486
 
J query post method in php
J query post method in phpJ query post method in php
J query post method in php
Samir Patel
 
Web app development_php_07
Web app development_php_07Web app development_php_07
Web app development_php_07
Hassen Poreya
 
Programming with php
Programming with phpProgramming with php
Programming with php
salissal
 
Html Xhtml And Xml 3e Tutorial 6
Html Xhtml And Xml 3e Tutorial 6Html Xhtml And Xml 3e Tutorial 6
Html Xhtml And Xml 3e Tutorial 6
larsonsb
 

Similar to 8.pdf (20)

Get and post methods in php - phpgurukul
Get and post methods in php  - phpgurukulGet and post methods in php  - phpgurukul
Get and post methods in php - phpgurukul
 
Html advanced-reference-guide for creating web forms
Html advanced-reference-guide for creating web formsHtml advanced-reference-guide for creating web forms
Html advanced-reference-guide for creating web forms
 
Web Development Course: PHP lecture 2
Web Development Course: PHP lecture 2Web Development Course: PHP lecture 2
Web Development Course: PHP lecture 2
 
J query post method in php
J query post method in phpJ query post method in php
J query post method in php
 
html forms and server side scripting
html forms and server side scriptinghtml forms and server side scripting
html forms and server side scripting
 
Php ch-2_html_forms_and_server_side_scripting
Php ch-2_html_forms_and_server_side_scriptingPhp ch-2_html_forms_and_server_side_scripting
Php ch-2_html_forms_and_server_side_scripting
 
Sperimentazioni di Tecnologie e Comunicazioni Multimediali: Lezione 5
Sperimentazioni di Tecnologie e Comunicazioni Multimediali: Lezione 5Sperimentazioni di Tecnologie e Comunicazioni Multimediali: Lezione 5
Sperimentazioni di Tecnologie e Comunicazioni Multimediali: Lezione 5
 
Getting Interactive: Chapter 14
Getting Interactive: Chapter 14Getting Interactive: Chapter 14
Getting Interactive: Chapter 14
 
full stack practical assignment msc cs.pdf
full stack practical assignment msc cs.pdffull stack practical assignment msc cs.pdf
full stack practical assignment msc cs.pdf
 
Php Learning show
Php Learning showPhp Learning show
Php Learning show
 
Web app development_php_07
Web app development_php_07Web app development_php_07
Web app development_php_07
 
Forms With Ajax And Advanced Plugins
Forms With Ajax And Advanced PluginsForms With Ajax And Advanced Plugins
Forms With Ajax And Advanced Plugins
 
Handout7 html forms
Handout7 html formsHandout7 html forms
Handout7 html forms
 
Programming with php
Programming with phpProgramming with php
Programming with php
 
Making web forms using php
Making web forms using phpMaking web forms using php
Making web forms using php
 
Html Xhtml And Xml 3e Tutorial 6
Html Xhtml And Xml 3e Tutorial 6Html Xhtml And Xml 3e Tutorial 6
Html Xhtml And Xml 3e Tutorial 6
 
PHP - Introduction to PHP Forms
PHP - Introduction to PHP FormsPHP - Introduction to PHP Forms
PHP - Introduction to PHP Forms
 
Html forms
Html formsHtml forms
Html forms
 
Laravel 8 export data as excel file with example
Laravel 8 export data as excel file with exampleLaravel 8 export data as excel file with example
Laravel 8 export data as excel file with example
 
Forms with html5
Forms with html5Forms with html5
Forms with html5
 

Recently uploaded

Recently uploaded (20)

Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 

8.pdf

  • 1.
  • 3.
  • 5.
  • 6. This webpage consists of three main parts: HTML, PHP, and CSS.
  • 7.
  • 8. The webpage contains a form that asks the user to enter their first name, last name, and age. The form has a submit button that the user can click to submit their information. When the user submits the form, the information is sent to a PHP script that processes the data and displays a message with the user's name, age, and birth year.
  • 9. The <form> tag specifies the method used to submit the form data, which is set to "post" using the "method" attribute. This means that the data entered in the form fields will be sent in the HTTP request body, rather than appended to the URL.
  • 10. The "action" attribute specifies the URL of the PHP script that will process the form data when the user submits the form.
  • 11. This HTML code creates a form with three input fields: "First Name", "Last Name", and "Your Age". Each input field is created with the <input> tag and has a corresponding "name" attribute that will be used to identify it in the PHP script. The "size" attribute of the input fields specifies their width in characters.
  • 12. The submit button is created using an <input> tag with the "type" attribute set to "submit" and the "value" attribute set to "Submit Information".
  • 14. This PHP code retrieves the values of the form fields using the $_POST superglobal array. The $_POST array contains key-value pairs where the keys are the "name" attributes of the form fields and the values are the data entered into those fields.
  • 15. The PHP code then assigns these values to variables for easier manipulation. The $firstname, $lastname, and $age variables correspond to the form fields with the same names.
  • 16. The first name and last name are then concatenated into a single string variable called $fullname. This is achieved by enclosing the variable names in double quotes and separating them with a space. The resulting string allows the values of the variables to be inserted into the text.
  • 17. Next, the code sets the $factor variable to 5 and adds it to the user's age to get the $ageplus variable. This is just an example calculation to demonstrate the use of variables.
  • 18. The code then uses the date() function to get the current year and assigns it to the $current_year variable. It subtracts the $ageplus value from the $current_year value to get the user's birth year and assigns it to the $birth_year variable.
  • 19. Finally, the PHP code generates a response using the print statement. It generates an HTML paragraph (<p>) with the user's full name, age, the calculated age plus 5, and their birth year.