faqts : Computers : Programming : Languages : PHP : Common Problems : URLs

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

36 of 45 people (80%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

I want to load a page conditionally. Is there any way?

May 29th, 2000 06:38
Falk Lucius, sony moparthi,


This is really simple. Just do the following PHP coding:
   <?php
   if (...condition...) {
      echo ("
         <script language=JavaScript>
         <!-- Hide from JavaScript-Impaired Browsers
         parent.location=\"test1.htm\"
         // End Hiding -->
         </script>
      ");
   } else {
      echo ("
         <script language=JavaScript>
         <!-- Hide from JavaScript-Impaired Browsers
         parent.location=\"test2.htm\"
         // End Hiding -->
         </script>
      ");
   }
   ?>
Just insert the proper condition, and replace "test1.htm" and 
"test2.htm" by the absolute or relative URL addresses.