SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Apr 2006
    Location
    Northern Ireland
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Switch statement not working after changing hosts

    Hello,

    My website was working perfectly before moving hosts. This morning, I uploaded all the the files on my current site to the FTP site of my new host. When I checked the site to ensure it was working correctly, I noticed the page was always staying on the default home page regardless of which link I clicked.

    The site is built using one main index.php page, which has an include ("maininc.php"); in the placedholder for the main content.

    The maininc file contains a switch statement as follows.

    PHP Code:
    <?php
                     
    switch ($topic)
                    {
                            case 
    "home":
                            include (
    "Home.html");
                            break;
                            case 
    "LivingWater":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=LivingWater"><u> Printable Version click Here</u></a></div>');
                            include (
    "living_water.htm");
                            break;
     
                            case 
    "WaterForLife":
                          echo (
    '<div class="print"><a target="_blank" href="print.php?topic=WaterForLife"><u>Printable Version click Here</u></a></div>');
                            include (
    "WaterForLife.htm");
                       break;
     
                            case 
    "seawater":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=seawater"><u>Printable Version click Here</u></a></div>');
                            include (
    "seawater.html");
                            break;
                            case 
    "essiac":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=essiac"><u>Printable Version click Here</u></a></div>');
                            include (
    "essiac.htm");
                            break;
                            case 
    "essiacprep":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=essiacprep"><u>Printable Version click Here</u></a></div>');
                            include (
    "essiac2.html");
                            break;
                            case 
    "cayenne":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=cayenne"><u>Printable Version click Here</u></a></div>');
                            include (
    "cayenne.html");
                            break;
     
                            case 
    "harmoniser":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=harmoniser"><u>Printable Version click Here</u></a></div>');
                            include (
    "personalharmoniser.html");
                            break;
     
                            case 
    "antibiotics":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=antibiotics"><u>Printable Version click Here</u></a></div>');
                            include (
    "antibiotics.html");
                            break;
                            case 
    "vortex":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=vortex"><u>Printable Version click Here</u></a></div>');
                            include (
    "vortex.html");
                            break;
     
                            case 
    "molasses":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=molasses"><u>Printable Version click Here</u></a></div>');
                            include (
    "Molasses.php");
                            break;
                            case 
    "waterbnfts":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=waterbnfts"><u>Printable Version click Here</u></a></div>');
                            include (
    "Whitepagewater.html");
                            break;
                            case 
    "anger":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=anger"><u>Printable Version click Here</u></a></div>');
                            include (
    "anger.html");
                            break;
     
                            case 
    "cancer":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=cancer"><u>Printable Version click Here</u></a></div>');
                            include (
    "Cancer.php");
                            break;
                            case 
    "cancerbusiness":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=cancerbusiness"><u>Printable Version click Here</u></a></div>');
                            include (
    "cancerbusin.html");
                            break;
     
                            case 
    "GeopathicStress":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=GeopathicStress"><u>Printable Version click Here</u></a></div>');
                            include (
    "GeopathicStress.htm");
                            break;
                            case 
    "HIV":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=HIV"><u>Printable Version click Here</u></a></div>');
                            include (
    "HIV.html");
                            break;
     
                            case 
    "hemp":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=hemp"><u>Printable Version click Here</u></a></div>');
                            include (
    "hemp.html");
                            break;
                            case 
    "marijuana":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=marijuana"><u>Printable Version click Here</u></a></div>');
                            include (
    "marijuana.html");
                            break;
                            case 
    "acid":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=acid"><u>Printable Version click Here</u></a></div>');
                            include (
    "acid.html");
                            break;
                            case 
    "pharmrak":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=pharmrak"><u>Printable Version click Here</u></a></div>');
                            include (
    "Pharmrak.html");
                            break;
                            case 
    "whatyoueat":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=whatyoueat"><u>Printable Version click Here</u></a></div>');
                            include (
    "eat.htm");
                            break;
                            case 
    "kombucha":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=kombucha"><u>Printable Version click Here</u></a></div>');
                            include (
    "kombucha.htm");
                            break;
                            case 
    "amalgams":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=amalgams"><u>Printable Version click Here</u></a></div>');
                            include (
    "amalgam.html");
                            break;
     
                            case 
    "nutrition":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=nutrition"><u>Printable Version click Here</u></a></div>');
                            include (
    "regen.html");
                            break;
                            case 
    "research":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=research"><u>Printable Version click Here</u></a></div>');
                            include (
    "research.html");
                            break;
                            case 
    "needwater":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=needwater"><u>Printable Version click Here</u></a></div>');
                            include (
    "needwater.html");
                            break;
                            case 
    "memoirs":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=memoirs"><u>Printable Version click Here</u></a></div>');
                            include (
    "memoirs.html");
                            break;
     
                            case 
    "contact":
                            include (
    "contact.html");
                            break;
                            case 
    "contacted":
                            include (
    "confirmation.php");
                            break;
                            case 
    "links":
                            include (
    "links.html");
                            break;
                            case 
    "oxygen":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=oxygen"><u>Printable Version click Here</u></a></div>');
                            include (
    "Oxyboost.html");
                            break;
     
                            case 
    "structuredwater":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=structuredwater"><u>Printable Version click Here</u></a></div>');
                            include (
    "structuredwater.html");
                            break;
                            case 
    "current":
                            include (
    "current.html");
                            break;
     
                            case 
    "LoveWater":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=LoveWater"><u>Printable Version click Here</u></a></div>');
                            include (
    "LoveWater.html");
                            break;
     
                            case 
    "HarmonicEnergy":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=HarmonicEnergy"><u>Printable Version click Here</u></a></div>');
                            include (
    "HarmonicEnergy.htm");
                            break;
     
                            case 
    "vaccination":
                            echo (
    '<div class="print"><a target="_blank" href="print.php?topic=vaccination"><u>Printable Version click Here</u></a></div>');
                            include (
    "vaccination.html");
                            break;
     
                            case 
    "Mantra":
                            include (
    "Mantra.html");
                            break;
          case 
    "Superbiomin":
          echo (
    '<div class="print"><a target="_blank" href="print.php?topic=Superbiomin"><u>Printable Version click Here</u></a></div>');
                            include (
    "superbiomin.html");
                            break;
     
                            case 
    "LivingFoods":
                            include (
    "LivingFoods.html");
                            break;
     
                            case 
    "leaflet":
                            include (
    "leaflet.html");
                            break;
     
                            case 
    "products":
                            include (
    "products.html");
                            break;
     
                            case 
    "LaFemme":
                            include (
    "lafemme.html");
                            break;
     
                            case 
    "kombuchabook":
                            include (
    "kombucha1.htm");
                            break;
     
                            case 
    "boweldetox":
                            include (
    "boweldetox.html");
                            break;
     
                            case 
    "brewpot":
                            include (
    "brewpot.html");
                            break;
     
                            case 
    "cayenne2":
                            include (
    "cayenne2.html");
                            break;
     
          case 
    "shop":
                            include (
    "transaction_successful.html");
                            break;
     
          case 
    "amalgamfillings":
          echo (
    '<div class="print"><a target="_blank" href="pdf/amalgamremoval.pdf"><u>Printable Version click Here</u></a></div>');
                            include (
    "amalgamfillings.html");
                            break;
     
          case 
    "audio":
                            include (
    "audiolibrary.html");
                            break;
                            default:
                            include (
    "Home.html");
                            break;
                    }
     
    ?>
    Please help, any advice you can provide would be greatly appreciated.

    Thanks,
    Toria

  2. #2
    I Never Give Up roosevelt's Avatar
    Join Date
    May 2005
    Posts
    515
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I think your new host has the super globals turned off. (Trust me, its a good thing). Try changing $topic to $_GET['topic'];

  3. #3
    SitePoint Evangelist
    Join Date
    May 2006
    Location
    Austin
    Posts
    401
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    How is the $topic variable set?

    If it is a $_GET variable then try using switch($_GET['topic'])
    Merchant Equipment Store - Merchant Services, POS, Equipment, and supplies.
    Merchant Account Blog | Ecommerce Blog

  4. #4
    SitePoint Member
    Join Date
    Apr 2006
    Location
    Northern Ireland
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thank You

    Yes, I used the
    Code:
    ($_GET['topic'])
    and it worked perfectly.

    Thank you! Thank you, Thank you.

    Toria


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •