The PHP function header () is used to parse a single part. The following is a script called calling. php :! DOCTYPEHTMLPUBLIC-W3CDTDHTML4.0TransitionalENwww.w3.org today we explain how to use the specific contentThe following is a script called calling. php:
- "-//W3C//DTD HTML 4.0 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd" >
- <html>
- <head>
- <title>Calling page example title>
- head>
- <body>
- <a href="action.php">Click here! a>
- body>
- html>
When the user clicks the connection above, the PHP function header () will call action. php. The following is the source code of action. php:
- Php
- // Database functions
-
- // Redirect
- Header ("Location: $ HTTP_REFERER ");
- Exit;
- ?>
There are two common errors to be reminded:
After the PHP function header () is called, an exit statement must be included to stop the script. otherwise, subsequent scripts may be output before the header is sent.
A common error in the header () function is:
Warning: Cannot add header information-headers already sent...
The PHP function header () can only be called before HTML output. Therefore, you need to check possible empty lines and spaces before php.
The following is a script called calling. php :! DOCTYPEHTMLPUBLIC "-// W3C // DTDHTML4.0Transitional //" http://www.w3.org /...