SlideShare a Scribd company logo
1 of 7
Download to read offline
Making Web Forms
   using PHP
       Krishna priya
      October 9, 2012
     C-DAC, Hyderabad
How Does a web form work?
PHP GET and POST Methods
 Before the browser sends the information, it encodes using
 a scheme called URL encoding. In this scheme, name/value
 pairs are joined with equal signs and different pairs are
 separated by the ampersand.
 There are two ways the browser client can send information
 to the web server.


                    The GET Method
                    The POST Method



         The PHP $_GET and $_POST variables are
    used to retrieve information from forms, like user input.
The GET Method
 The GET method sends the encoded user information
 appended to the page request. The page and the encoded
 information are separated by the ? character.

 http://www.test.com/index.htm?name1=value1&name2=v
 alue2

 The GET method is restricted to send upto 1024 characters
 only.
 Never use GET method if you have password or other
 sensitive information to be sent to the server.
  GET can't be used to send binary data, like images or word
 documents, to the server.
 The information is encoded as described in case of GET
 method and put into a header called QUERY_STRING.
The POST Method
 The POST method transfers information via HTTP headers.

  The POST method does not have any restriction on data
 size to be sent.

 The POST method can be used to send ASCII as well as
 binary data

 The data sent by POST method goes through HTTP header
 so security depends on HTTP protocol. By using Secure
 HTTP you can make sure that your information is secure.
Differences
 All the values which is submitted by the GET method will be
 appended to the URL.
 Where as POST method send the data with out appending the
 URL(hidden)

 In GET Method we can bookmark the URLs where as in POST
 method its not possible

 In GET Method there is a limit for passing the data from one page
 to another
 But in POST we can send large amount of data

 Compared to POST get is Faster

 POST is more secure than get method

 All the informations which is passed by GET method will be stored
 in webserver(log file) but in POST we can not
Example
Welcome.html               Forms.php
<html>                     <html>
<body>                     <body>
<form action="forms.php"   Welcome <?php echo
method="post">             $_POST["fname"]; ?>!<br />
Name: <input type="text"   You are <?php echo
name="fname" />            $_POST["age"]; ?> years old.
Age: <input type="text"    </body>
name="age" />              </html>
<input type="submit" />
</form>                    Output:
</body>                    Welcome sai!
</html>                    You are 15 years old.
Output:

More Related Content

What's hot

Form using html and java script validation
Form using html and java script validationForm using html and java script validation
Form using html and java script validation
Maitree Patel
 
Php Form
Php FormPhp Form
Php Form
lotlot
 
05 html-forms
05 html-forms05 html-forms
05 html-forms
Palakshya
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
tutorialsruby
 
.NET Code Examples
.NET Code Examples.NET Code Examples
.NET Code Examples
GaryB47
 

What's hot (20)

03 the htm_lforms
03 the htm_lforms03 the htm_lforms
03 the htm_lforms
 
Form using html and java script validation
Form using html and java script validationForm using html and java script validation
Form using html and java script validation
 
GET and POST in PHP
GET and POST in PHPGET and POST in PHP
GET and POST in PHP
 
Form Validation in JavaScript
Form Validation in JavaScriptForm Validation in JavaScript
Form Validation in JavaScript
 
Php Form
Php FormPhp Form
Php Form
 
Form handling in php
Form handling in phpForm handling in php
Form handling in php
 
HTML5 Web Forms
HTML5 Web FormsHTML5 Web Forms
HTML5 Web Forms
 
2. HTML forms
2. HTML forms2. HTML forms
2. HTML forms
 
Html forms
Html formsHtml forms
Html forms
 
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
 
Forms in html5
Forms in html5Forms in html5
Forms in html5
 
Html form tag
Html form tagHtml form tag
Html form tag
 
HTML 5 Simple Tutorial Part 4
HTML 5 Simple Tutorial Part 4HTML 5 Simple Tutorial Part 4
HTML 5 Simple Tutorial Part 4
 
05 html-forms
05 html-forms05 html-forms
05 html-forms
 
DIWE - Coding HTML for Basic Web Designing
DIWE - Coding HTML for Basic Web DesigningDIWE - Coding HTML for Basic Web Designing
DIWE - Coding HTML for Basic Web Designing
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
HTML 5 Simple Tutorial Part 3
HTML 5 Simple Tutorial Part 3HTML 5 Simple Tutorial Part 3
HTML 5 Simple Tutorial Part 3
 
FYBSC IT Web Programming Unit III Document Object
FYBSC IT Web Programming Unit III  Document ObjectFYBSC IT Web Programming Unit III  Document Object
FYBSC IT Web Programming Unit III Document Object
 
RicoAjaxEngine
RicoAjaxEngineRicoAjaxEngine
RicoAjaxEngine
 
.NET Code Examples
.NET Code Examples.NET Code Examples
.NET Code Examples
 

Viewers also liked

S.G.Balaji Resume
S.G.Balaji ResumeS.G.Balaji Resume
S.G.Balaji Resume
Balaji Sg
 
Geek Austin PHP Class - Session 4
Geek Austin PHP Class - Session 4Geek Austin PHP Class - Session 4
Geek Austin PHP Class - Session 4
jimbojsb
 
Memphis php html form processing with php
Memphis php   html form processing with phpMemphis php   html form processing with php
Memphis php html form processing with php
Joe Ferguson
 
Creating a Simple PHP and MySQL-Based Login System
Creating a Simple PHP and MySQL-Based Login SystemCreating a Simple PHP and MySQL-Based Login System
Creating a Simple PHP and MySQL-Based Login System
Azharul Haque Shohan
 

Viewers also liked (18)

3 php forms
3 php forms3 php forms
3 php forms
 
Script login form php
Script login form phpScript login form php
Script login form php
 
S.G.Balaji Resume
S.G.Balaji ResumeS.G.Balaji Resume
S.G.Balaji Resume
 
Geek Austin PHP Class - Session 4
Geek Austin PHP Class - Session 4Geek Austin PHP Class - Session 4
Geek Austin PHP Class - Session 4
 
Ns3
Ns3Ns3
Ns3
 
Memphis php html form processing with php
Memphis php   html form processing with phpMemphis php   html form processing with php
Memphis php html form processing with php
 
ns-3: History and Future
ns-3: History and Futurens-3: History and Future
ns-3: History and Future
 
Network Simulation NS3
Network Simulation NS3Network Simulation NS3
Network Simulation NS3
 
Creating a Simple PHP and MySQL-Based Login System
Creating a Simple PHP and MySQL-Based Login SystemCreating a Simple PHP and MySQL-Based Login System
Creating a Simple PHP and MySQL-Based Login System
 
Building Topology in NS3
Building Topology in NS3Building Topology in NS3
Building Topology in NS3
 
Tutorial ns 3-tutorial-slides
Tutorial ns 3-tutorial-slidesTutorial ns 3-tutorial-slides
Tutorial ns 3-tutorial-slides
 
ns-3 Tutorial
ns-3 Tutorialns-3 Tutorial
ns-3 Tutorial
 
Php and MySQL
Php and MySQLPhp and MySQL
Php and MySQL
 
Php tutorial
Php tutorialPhp tutorial
Php tutorial
 
PHP Web Programming
PHP Web ProgrammingPHP Web Programming
PHP Web Programming
 
Class 4 - PHP Arrays
Class 4 - PHP ArraysClass 4 - PHP Arrays
Class 4 - PHP Arrays
 
Php Presentation
Php PresentationPhp Presentation
Php Presentation
 
Login and Registration form using oop in php
Login and Registration form using oop in phpLogin and Registration form using oop in php
Login and Registration form using oop in php
 

Similar to Making web forms using php

Web app development_php_07
Web app development_php_07Web app development_php_07
Web app development_php_07
Hassen Poreya
 

Similar to Making web forms using php (20)

Get and post methods
Get and post methodsGet and post methods
Get and post methods
 
Lecture7 form processing by okello erick
Lecture7 form processing by okello erickLecture7 form processing by okello erick
Lecture7 form processing by okello erick
 
PHP-Part4
PHP-Part4PHP-Part4
PHP-Part4
 
Introduction to php web programming - get and post
Introduction to php  web programming - get and postIntroduction to php  web programming - get and post
Introduction to php web programming - get and post
 
forms.pptx
forms.pptxforms.pptx
forms.pptx
 
Working with data.pptx
Working with data.pptxWorking with data.pptx
Working with data.pptx
 
Web Development Course: PHP lecture 2
Web Development Course: PHP lecture 2Web Development Course: PHP lecture 2
Web Development Course: PHP lecture 2
 
Web app development_php_07
Web app development_php_07Web app development_php_07
Web app development_php_07
 
Common Gateway Interface
Common Gateway InterfaceCommon Gateway Interface
Common Gateway Interface
 
Web Application Development using PHP Chapter 5
Web Application Development using PHP Chapter 5Web Application Development using PHP Chapter 5
Web Application Development using PHP Chapter 5
 
Get method and post method
Get method and post methodGet method and post method
Get method and post method
 
Chapter 1.Web Techniques_Notes.pptx
Chapter 1.Web Techniques_Notes.pptxChapter 1.Web Techniques_Notes.pptx
Chapter 1.Web Techniques_Notes.pptx
 
Introduction to web development - HTML 5
Introduction to web development - HTML 5Introduction to web development - HTML 5
Introduction to web development - HTML 5
 
RESTful Web Services with JAX-RS
RESTful Web Services with JAX-RSRESTful Web Services with JAX-RS
RESTful Web Services with JAX-RS
 
The constrained application protocol (coap) part 2
The constrained application protocol (coap)  part 2The constrained application protocol (coap)  part 2
The constrained application protocol (coap) part 2
 
The constrained application protocol (coap) part 2
The constrained application protocol (coap)  part 2The constrained application protocol (coap)  part 2
The constrained application protocol (coap) part 2
 
The constrained application protocol (co ap) part 2
The constrained application protocol (co ap)  part 2The constrained application protocol (co ap)  part 2
The constrained application protocol (co ap) part 2
 
Session,cookies and get and post methods
Session,cookies  and get and post methodsSession,cookies  and get and post methods
Session,cookies and get and post methods
 
HTTP Basics Demo
HTTP Basics DemoHTTP Basics Demo
HTTP Basics Demo
 
Copy of cgi
Copy of cgiCopy of cgi
Copy of cgi
 

More from krishnapriya Tadepalli (13)

Web content accessibility
Web content accessibilityWeb content accessibility
Web content accessibility
 
Data visualization tools
Data visualization toolsData visualization tools
Data visualization tools
 
Drupal vs sitecore comparisons
Drupal vs sitecore comparisonsDrupal vs sitecore comparisons
Drupal vs sitecore comparisons
 
Open Source Content Management Systems
Open Source Content Management SystemsOpen Source Content Management Systems
Open Source Content Management Systems
 
My sql vs mongo
My sql vs mongoMy sql vs mongo
My sql vs mongo
 
Node.js
Node.jsNode.js
Node.js
 
Json
JsonJson
Json
 
Comparisons Wiki vs CMS
Comparisons Wiki vs CMSComparisons Wiki vs CMS
Comparisons Wiki vs CMS
 
Sending emails through PHP
Sending emails through PHPSending emails through PHP
Sending emails through PHP
 
Php introduction
Php introductionPhp introduction
Php introduction
 
Using advanced features in joomla
Using advanced features in joomlaUsing advanced features in joomla
Using advanced features in joomla
 
Presentation joomla-introduction
Presentation joomla-introductionPresentation joomla-introduction
Presentation joomla-introduction
 
Language enabling
Language enablingLanguage enabling
Language enabling
 

Making web forms using php

  • 1. Making Web Forms using PHP Krishna priya October 9, 2012 C-DAC, Hyderabad
  • 2. How Does a web form work?
  • 3. PHP GET and POST Methods Before the browser sends the information, it encodes using a scheme called URL encoding. In this scheme, name/value pairs are joined with equal signs and different pairs are separated by the ampersand. There are two ways the browser client can send information to the web server. The GET Method The POST Method The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input.
  • 4. The GET Method The GET method sends the encoded user information appended to the page request. The page and the encoded information are separated by the ? character. http://www.test.com/index.htm?name1=value1&name2=v alue2 The GET method is restricted to send upto 1024 characters only. Never use GET method if you have password or other sensitive information to be sent to the server. GET can't be used to send binary data, like images or word documents, to the server. The information is encoded as described in case of GET method and put into a header called QUERY_STRING.
  • 5. The POST Method The POST method transfers information via HTTP headers. The POST method does not have any restriction on data size to be sent. The POST method can be used to send ASCII as well as binary data The data sent by POST method goes through HTTP header so security depends on HTTP protocol. By using Secure HTTP you can make sure that your information is secure.
  • 6. Differences All the values which is submitted by the GET method will be appended to the URL. Where as POST method send the data with out appending the URL(hidden) In GET Method we can bookmark the URLs where as in POST method its not possible In GET Method there is a limit for passing the data from one page to another But in POST we can send large amount of data Compared to POST get is Faster POST is more secure than get method All the informations which is passed by GET method will be stored in webserver(log file) but in POST we can not
  • 7. Example Welcome.html Forms.php <html> <html> <body> <body> <form action="forms.php" Welcome <?php echo method="post"> $_POST["fname"]; ?>!<br /> Name: <input type="text" You are <?php echo name="fname" /> $_POST["age"]; ?> years old. Age: <input type="text" </body> name="age" /> </html> <input type="submit" /> </form> Output: </body> Welcome sai! </html> You are 15 years old. Output: