NetAdminTools.com
 
SignalQ Sites:
NetAdminTools - Coprolite - NoNIC - SpotBridge - NAW
RoboCoop - AreWeDown - SolarPower - SysAdminTools
Xfig - Gold Loaf - GeekPapa - FixGMC - MCJ - FixRambler
Categories:
GNU/Linux | Homebrew designs | Perl | Administration | Backup/Recovery | Bugs/Fixes | Certification | Database | Email | File/Print | Hardware | Information Grab Bag | Interoperability | GNU/Linux ABCs | Monitoring | Name Resolution | Network Services | Networking | Remote Control | Security | Desktop | Web | BSD | Solaris | GIAGD | REALbasic

Last 30 Days | Last 60 Days | Last 90 Days | All Articles | RSS | Hail Support


Categories:
·GNU/Linux
·Homebrew designs
·Perl
·Administration
·Backup/Recovery
·Bugs/Fixes
·Certification
·Database
·Email
·File/Print
·Hardware
·Information Grab Bag
·Interoperability
·GNU/Linux ABCs
·Monitoring
·Name Resolution
·Network Services
·Networking
·Remote Control
·Security
·Desktop
·Web
·BSD
·Solaris
·GIAGD
·REALbasic
·All Categories


How to Redirect After HTML Output With PHP and JavaScript
Topic: Web   Posted:2005-10-29
Printer Friendly: Print

spacerspacer
You can't use PHP to change the header information with the header function after HTML output has begun. If you do, you will get an error like:

Warning: Cannot modify header information - headers already sent by
...

What you can do, midstream, though, is use a meta tag:

echo "<meta http-equiv='Refresh' content='0; URL=location.php?date=".$date."'>";

This is a PHP command that removes all variables from the URL (location.php) except the date. This is useful if you happen to be passing temporary variables, deal with them, and want to remove them from the URL when you are done, without leaving the current page. The 0 is the time before the refresh. More info on this here. A word of warning. The app we are testing this on runs on Firefox 1.0.7. It is an app purely for our usage, and so we don't really care about whether it works with other browsers, so test this. The idea is valid, though, regardless of your browser, it just might take some further tweaking. Now, this is *not* specific to PHP. Whatever you use to serve up the HTML that can spit out what you specify can send the above. For that matter, at least on our browser, simply embed the meta tag from the above line in a static HTML page, and it should work.

For the complete program that uses this, see this article.




Please read our Terms of Use
Microsoft, Windows, Windows XP, Windows 2003, Windows 2000, and NT are either trademarks or registered trademarks of Microsoft Corporation. NetAdminTools.com is not affiliated with Microsoft Corporation. Linux is a registered trademark of Linus Torvalds, and refers to the Linux kernel. The operating system of most distributions that contain the Linux kernel is GNU/Linux. All logos and trademarks in this site are property of their respective owner. Copyright 1997-2008 NetAdminTools.com

Created by:
MCJ
MCJ CMS