Some features in PHP help much, especially when there is the need of working with forms. GET, POST and REQUEST are the most used and then we’ll know a little more about each of them.

GET

This collection allows the programmer can get a variable value that often comes directly from a URL. Check out the example below:

www.test.com/?x=1Ey=2

<?php

echo(“The value of X is “.$_GET[‘x’]);

echo(“The value of Y is “.$_GET[‘y’]);

?>

As WEB languages ​​do not keep this state variable is one way to move a value from one page to another.

POST

Using this collection is possible to obtain data from a particular field and use it in programming, as example below:

<FORM NAME=”form1″ METHOD=”post” ACTION=”page.php”>
Field 1:
<INPUT TYPE=”text” NAME=”field1″>
<BR>
Field 2:
<TEXTAREA NAME=”field2″></TEXTAREA>
<BR>
<INPUT TYPE=”submit” VALUE=”SEND”>
</FORM>

<?php
echo(“First value is ” . $_POST[‘field1’]);
echo(“Second value is ” . $_POST[‘field2’]);
?>

This is one of the most widely used collections in PHP since it is created from whole structure forms necessary for the operation of any type of web application.

REQUEST

This is called generic collection, it is returned the value of the last variable, according to a php.ini setting. Check out the example below:

<FORM NAME=”form1″ METHOD=”post” ACTION=”page.php?x=1″>
<INPUT TYPE=”text” NAME=”txtField1″ VALUE=”Value is”>
<INPUT TYPE=”submit” VALUE=”SEND”>
</FORM>

<?php
echo($_REQUEST[‘v’]);
?>

What is printed result is that the value “Text Field Value” according to the logical file described above.

php

These methods are part of everyday life for any PHP developer as well as the development tool of choice. Therefore, choosing the right tool you will use in your development projects. With Scriptcase you has a number of resources that will help you to have much more flexibility in their development process, meet our tool and be surprised.

You might also like…

PROCESAMIENTO AJAX EN SCRIPTCASE

Ajax en los formularios de Scriptcase puede usarse para recargar un campo de tipo de select basado e...

IMPORTAR IMAGENES DE LA BASE DE DATOS Y UTILIZAR CLASES DE BOOSTRAP

Como muchas personas ya saben, Bootstrap es una biblioteca de front-end libre y de código abierto p...

TENDENCIAS DE DESARROLLO WEB PARA 2017

Usted verá en este post tendencias para 2017 en Diseño Web, en el medio digital y en el desarrollo...

Comment this post

Get new posts, resources, offers and more each week.

We will use the information you provide to update you about our Newsletter and Special Offers. You can unsubscribe any time you want by clinck in a link in the footer of any email you receive from us, or by contacting us at sales@scriptcase.net. Learn more about our Privacy Police.