Re: function problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Richard Lynch <ceo@xxxxxxxxx>:
>
> > '$shippingCountry1')")))
> >  {
> >    echo "the insertiont cannot be done";
>
> echo mysql_error();
>
> http://php.net/mysql_error
>
> >    exit();
> >  }
> >     header("Location:http://$HTTP_HOST/$DOCROOT/allright.html";);
>
> DON'T DO THAT!!!
>
> Just do:
> include 'allright.html';
>
> The Location header is for a document that has *MOVED* to a new URL.
>
> Your document has not moved.

Actually, untrue. From the W3C HTTP 1.1 specs:

    The Location response-header field is used to redirect the recipient
    to a location other than the Request-URI for completion of the
    request or identification of a new resource.

Yes, one of its primary uses is for 3xx errors, and it is used in that
arena to indicate a change in a page's location. However, it can also be
used in 2xx responses to indicate a page dynamically created for the
request or simply to indicate that a 'pass-thru' was used in the
request.

It's a very common practice in web application programming -- not just
PHP, but the field in general -- after a successful form submission to
redirect to another page. Doing so can help prevent back-button issues
when forms need to be filled out in series -- for example, when you
don't want duplicate records created in the database.

-- 
Matthew Weier O'Phinney           | mailto:matthew@xxxxxxxxxx
Webmaster and IT Specialist       | http://www.garden.org
National Gardening Association    | http://www.kidsgardening.com
802-863-5251 x156                 | http://nationalgardenmonth.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux