Forum Moderators: coopster
Why is this a bad idea? Are there security issues involved?
One of my pages contains 4 different forms. The reason is because I don't want my users getting redirected to another page during this process. Is this problematic having so many forms on a single page. You betcha!
The logic has to be right. I have to determine which form was submitted. Did I pass the right values? Are there additional values being passed? How does my script know where to start processing? Some of this is simply extra overhead.
I might have coded those 4 forms into individual pages, and saved myself some significant development time. So, I'm only speculating as to why such a thing might not be recommended, and it comes down to increased complexity and development time.
<form action="<?php echo $_SERVER['PHP_SELF'];?>">
It's a no no to trust server variables like this. See [blog.phpdoc.info...] for further info.
Tim
I almost ALWAYS do:
<form action="">
And I don't have issues with it. I just checked the back button and no worries there - I guess it just depends on your form setup and your server config. I know that different caching methods change the back button behavior in IE for forms that are POST'ed.
b
I've never had any problems, and back and forward work fine for me. But now you've got me worried what other people experience. :(
FalseDawn, I hadn't considered the issue of the back and forward buttons -- need to look further into that.
Timotheos, thanks for the heads up on $_SERVER['PHP_SELF'] -- that's simply amazing! I'd heard that some of the $_SERVER fields should be considered tainted, but didn't realise that extended to PHP_SELF.
bsterz, I found this post [webmasterworld.com] which indicated that Safari and Konqueror had a problem with action="". I don't whether it's still a problem.