ok, so here's my deal... i read/heard somewhere that if a user submits a form, and the watever.php file handles it... inserts the $_POST data into a database or watever it needs to do... then the watever.php file uses a header("location:blaaa.php"); statement that it's against strict http 1.1 specification...
is this true? is it good programming practice to use the header(location) combination after a user submits a form and the php hanldes the data?? what do you guys do?
header("location:blaaaa.php") http 1.1 specificati
Moderator: General Moderators
- fendtele83
- Forum Commoner
- Posts: 27
- Joined: Tue Oct 25, 2005 2:21 pm
- Location: Woodbridge, NJ
change it to header('Location: http://example.com/blaa.php'); and there's nothing to worry about...
Re: header("location:blaaaa.php") http 1.1 specifi
There are a couple of different issues here.fendtele83 wrote:ok, so here's my deal... i read/heard somewhere that if a user submits a form, and the watever.php file handles it... inserts the $_POST data into a database or watever it needs to do... then the watever.php file uses a header("location:blaaa.php"); statement that it's against strict http 1.1 specification...
is this true? is it good programming practice to use the header(location) combination after a user submits a form and the php hanldes the data?? what do you guys do?
First, the spec says that a header redirect (location) requires an absolute url - not a relative one. So, like timvw said, slap the FQDN on there, and you will be in compliance.
Now, the other issue you have is redirecting on a page that makes a change. Thats not "wrong" or non-compliant, but it can pose a problem. If a user browses, following your description, from form -> whatever.php, and then ends up on blaaa.php, it can confuse the user, prevent back-button browsing, and more.
Depending on how it is implemented, it can be no big deal, or very challenging for some users with assisted browsing technologies. My suggestion is to test it with eLinks (available on most unixes), and try browsing forward and back through the form submission process. If you can do both easily, you've probably designed it well enough.
- fendtele83
- Forum Commoner
- Posts: 27
- Joined: Tue Oct 25, 2005 2:21 pm
- Location: Woodbridge, NJ
thankssss
thanks guys, im probably going to implement the location:with the full URL