Let's say I have a form and the action is thus;
<form name=\"managebatch\" action=\"" . basename($PHP_SELF) . "?bid=edit\" method=\"POST\">\n";
Note the 'bid' attribute. Now, I have a case statement in which stuff takes place since the form has called it because of the 'bid' attribute. Before I break from the case I do this;
unset($_GET['bid']);
SIDEBAR: You should all note that I ma editing someone else's code. Someone who did not bother to comment their code. [ed note: Yes, they work for the same company, but are not in the department, yet management says that I have to support their code. I asked if we could at least teach them commenting and revision control. They looked at me as if I was a space alien]. Someone who believes that all forms should use $PHP_SELF (because whatever book they have showed them this, so therefore it must be good for everything).
The URL comes back and the 'bid' attribute is still there. Is this to be
expected? If so, do you have any advice (other than copious amounts of
alcohol) for dealing with this?
Thank you, I really appreciate your help.
I may be missing something here; not understanding what you're saying (happens all the time according to my wife), but even if you unset the $_GET variables, it will still be in the URL, as that's where the form posted too. And since the code is written to post to PHP_SELF, it will keep that value for the next load of the page. You could get rid of the query string, and header() redirect to the posting page without the query.
-- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 john@xxxxxxxxxxxx
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php