Re: function problem

From: Date: Mon, 03 Jan 2005 20:15:18 +0000
Subject: Re: function problem
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-205549@lists.php.net to get a copy of this message
* Richard Lynch <ceo@l-i-e.com>: > > > '$shippingCountry1')"))) > > { > > echo "the insertiont cannot be done"; > > echo mysql_error(); > > http://php.net/mysql_error > > > exit(); > > } > > header("Location:}ð‰ > > žÃéÌOÌb«åShttp://$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@garden.org Webmaster and IT Specialist | http://www.garden.org National Gardening Association | http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org

« previous php.general (#205549) next »