Php, mysq lpart4(processing html form)
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Php, mysq lpart4(processing html form)

  • 1,255 views
Uploaded on

how to gwhow to validate php form

how to gwhow to validate php form

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,255
On Slideshare
1,255
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
11
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Processing HTML FORM Author:- Subhasis CMC
  • 2. The form code looks as like below
  • 3. Output of the code will be
  • 4. html form tags Form Tags Output <input type = "text" name = "name"/> <input type="radio" name ="gender" value ="m“/> <input type="CHECKBOX" name="age" value ="Y" checked/> <SELECT name = "education"> <option selected value=“pg">P.Graduate</option> </SELECT> <input type="submit" name="submit" value="submit"> <TEXTAREA name = "aboutu" rows ="5" cols ="28" ></TEXTAREA>
  • 5. Main form tag • Method =“post” – This is the way of processing our user filled data into the form. Instead of „POST‟ we can use „GET‟. • GET – when we use get method the data processed will be visible. The amount of data is to be sent is limited • POST – when we use POST method the data processed will be not visible. The amount of data is to be sent is not limited.
  • 6. Continue • When we process the form the html sends the data to file which is in action tag. Here when the form will process it will sends to “formfill.php”. • We need some php code to get those values which will be sent by the form tag . • We have three types. ▫ $_GET = we used to get the values from html form when method is get ▫ $_POST = we used to get the values from html form when method is post ▫ $_REUQEST = it works on both .
  • 7. PHP code to get the form values • In PHP the $_GET,$_POST & $_REQUEST are special array in PHP. • It collect the information which filed has collected the values . • Simply there is no value about the fields on which there is no values entered by the user. • To check that use the step by step tutorial. I will use $_POST for this what ever you want you can refer else you can refer what I am referring.
  • 8. Checking the Special array $_POST • Step -1 :- write the html file with form as below. Next step is to write a php code for processing, the name will be in action tag as below. Here my php file name is “test.php”. Let‟s write that
  • 9. Continue …. • Step – 2 :- writing the php file “test.php”
  • 10. What is $_POST,$_GET & $_REQUEST ? • There are three special global arrays in PHP. ▫ $_POST ▫ $_GET ▫ $_REQUEST • When ever you submit any data to get those value you can use any one of the above array. • $_POST is more robust than $_GET, $_REQUEST is combined both of them.
  • 11. Cont’d…… • $_GET is not secured . • $_GET is not capable to send large amount of data • $_POST is secured and able to send unlimited amount of data. • So $_POST is more preferable.
  • 12. Let’s receive data sent by HTML form • To fetch the data from form we have to specify name for each element of the form. • Once you do that any data you will send from FORM it will be fetch by the special array $_GET & $_POST. • To reuse it you can store it to some variable and do what ever else you want to do.
  • 13. An example(form code)
  • 14. PHP code to process
  • 15. Form validation