simple example on redirecting to other URL

From: Date: Mon, 04 Dec 2000 10:18:46 +0000
Subject: simple example on redirecting to other URL
Groups: php.general 
Request: Send a blank email to php-general+get-28552@lists.php.net to get a copy of this message
I'm bothered by how to redirect to desired URL in PHP.... Finally, I find my own solution...(use javascript.....:Q) Share it with PHPers.....it u got better way, please let me know...thanks I write a include file, named "redirect.inc".... then use the following two line to redirect to desired URL. the first parameter is the target the url shows, the 2nd is the desired URL include("redirect.inc"); redirect("parent","index1.php"); =========================================================================== <? function redirect($target,$url) { echo "<script language=JavaScript>"; echo "function MM_goToURL() {"; echo " var i, args=MM_goToURL.arguments; document.MM_returnValue = false;"; echo " for (i=0; i<(args.length-1); i+=2)"; echo "eval(args[i]+\".location='\"+args[i+1]+\"'\");"; echo "}"; echo "</script>"; echo "<script>MM_goToURL(\"$target\",\"$url\")</script>"; } ?> =========================================================================== *******************Internet Email Confidentiality Footer******************* Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email. Please advise immediately if you or your employer do not consent to Internet email for messages of this kind. Opinions, conclusions and other information in this message that do not relate to the official business of my firm shall be understood as neither given nor endorsed by it.

« previous php.general (#28552) next »