Ticker

6/recent/ticker-posts

What is Php GET and POST Method?

           

 PHP- GET & POST ?

 Yesterday I got Message regarding PHP- GET & POST method then I explain below all these things related to this. If You have question regarding Php, web services, cloud computing plz Comment me.. Next day I'll solve your problems... The question will be raised in your mind while studying PHP--> YES/NO(Post Comment if yes/no).


Ok Let's start- PHP - GET & POST is a method of the PHP that is used to send the information from the client-side to the webserver.   
        - Before the browser sends the information to the web server it's first to encode it using the scheme called URL encoding-In this scheme the name/value are joined with an equal sign(=) and separated by the commas for another pair of the name/value.         EX-  Name1=value1&Name2=value2&Name3=value3 like this. After the information encoded it will send to the webserver.       Do/Don't of the GET Method--> 1) You will send only up to 2000 characters only. 2) GET didn't send the binary data like images and word documents to the server. 3) Never Use the GET Method while you're using the username and password. 4) You have to use the $_GET(associative array ) for accessing the information from the webserver. 5) The information is appended with the page request when the GET method sends the information. The Information and page request both are separated by the ?.
                                                 Example--> http://www.stuff2learn.blogspot.in/index.html?name1=value1&name2&value2 6) The information sent through the GET method is visible to everyone. 7) The GET method is only used for non-sensitive data. 8) Don't be used the GET method for the sensitive/confidential data/information. 

9) Example- Try this Example--

 
<?php

if($_GET["name"] && $_GET["age"]) {

echo "NAME is" . $_GET['name'];
echo "AGE is " . $_GET['age'];
}

<html>
<head>
<title>
www.stuff2learn.blogspot.in
</title>
<body>
<form action="<?php $_SELF_PHP ?>" method="GET">

NAME:
<input type="text" name="name">

AGE:
<input type="text" name="age">

<input type="button" value="submit">

</form>
</body>

</head>

</html>
                                                                

                                                                                                PHP- POST ?


Let's start ----> Php--> POST is also a method in a PHP programming. It is also a GET method but has some differences.            $_POST(Syntax)- The POST method is widely used to collecting form data that is submitted by POST.  Do/Don't of POST method--> 1) POST method is widely used for sensitive data. 2) No limits on the number of characters are sent. 3) POST method is also send the the ASCII and binary data like images and word documents. 4) Information send via the POST method is invisible to others. 5) We don't bookmark the page because the information is not shown on the URL(Universal Research Locator) bar.


6)EXAMPLE--->              --------- Try this Example-------

 
<?php

if($_GET["name"] && $_GET["age"]) {

echo "NAME is" . $_GET['name'];
echo "AGE is " . $_GET['age'];
}

<html>
<head>
<title>
www.stuff2learn.blogspot.in
</title>
<body>
<form action="<?php $_SELF_PHP ?>" method="POST">

NAME:
<input type="text" name="name">

AGE:
<input type="text" name="age">

<input type="button" value="submit">

</form>
</body>
</head>

</html>





                          ----------THANK YOU------------

Post a Comment

0 Comments