|
Posted by tg-php on 10/04/20 11:05
If your question is a matter of "Is this a good programming practice" then I think it's ok. There are times when something like this could be really useful.
Should people get into the practice of using this kind of thing? I think it really depends on the circumstances and there's definitely times when it would just make things more confusing which is bad programming practice in general.
So unless there's a web server that looks for POST data and ignores any GET data sent (which I've never heard of but I'm guessing that someone's managed to create a web server at one point that did this.. on purpose or not), then I think this is an ok technique if there's not a simpler one that does the same thing.
Simplicity is really the key, but it's nice to know that you CAN use GET and POST together if you want/need to. Just as long as it's not complicating the situation for no reason.
-TG
= = = Original message = = =
Browser history: I do not want it to contain any URIs to files which require
some sort of id variable passed.
Example:
1. http://www.entity.org/edit.php
(should produce an error or redirect to entity list)
2. http://www.entity.org/edit.php?id=1
(should display editing interface)
Now I really do not like to use redirects in case of errors. So I could
constantly use (2) second form of URI, even in POST requests.
But then, if I already have "id" in $_GET, why the redundancy of sending
another "id" to $_POST?
B.
On Tuesday 11 January 2005 09:48, you wrote:
> Is it just me or ... why on earth would you want to populate both GET and
> POST arrays through this obscure way of coding ?
>
> If you really have a form where you dont have a clue wether your data comes
> from GET or POST, it should be way less effort to copy one array to another
> or have a lookup function to return the given value.
>
> / Lars
>
> ----- Original Message -----
> From: "Bostjan Skufca @ domenca.com" <bostjan.skufca@domenca.com>
> To: <php-general@lists.php.net>
> Sent: Tuesday, January 11, 2005 5:42 PM
> Subject: [PHP] $_GET & $_POST simultaneously
>
> > Hello,
> >
> > If I create form like this
> > <form name="form" action="##_URI_ROOT##/entity/edit.php?a=b"
> > method="post">
> > <input type="hidden" name="action" value="modify" />
> > ...
> >
> > both arrays contain appropriate variables when submitted:
> > ::: $_GET :::
> >
> > Array
> > (
> > [a] => b
> > )
> >
> > ::: $_POST :::
> >
> > Array
> > (
> > [action] => modify
> > ...
> > )
> >
> > Now what I am interested in is if this is valid behaviour regarding HTTP
> > specification and if other platforms support this interference of GET and
> > POST variables in request?
> >
> > Thank your for your answers,
> > Bostjan
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
Navigation:
[Reply to this message]
|