tags:

views:

30

answers:

2

What the difference with POST and REQUEST? Does it recommend if I plan to submit the whole form without the need to write parameters?

link.php?param=1&param=2&param=3
+4  A: 

$_REQUEST includes $_COOKIE, $_GET and $_POST.

If you know the type of your request, you are best to use $_GET or $_POST.

Gazler
so if I POST from index.php to be submit to link.php, how can I get the params to retain in url address with link.php?
proyb3
You do a submit your form as a GET to pass the variables through the querystring.
Gazler
Oh, thank you, will try it.
proyb3
if you want the form to add values in the URL, you use "<form method="GET" action="blah">
netrox
+1  A: 

$_POST contains POST data, while $_REQUEST contains POST, query string and cookie data.

Use the specific superglobal as that way you only get data from where you expect.

David Dorward
so if I POST from index.php to be submit to link.php, how can I get the params to retain in url address with link.php?
proyb3
If you want to pass the data to the handler for the POST request, make them hidden inputs. If you want to make the result of the POST request bookmarkable / linkable, follow the POST-Redirect-GET pattern: http://en.wikipedia.org/wiki/Post/Redirect/Get
David Dorward
@proyb3: I guess you should change the `<form method="post">` to `<form method="get">` is that what you want?
Omar Dolaimy