Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6056861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:25:28+00:00 2026-05-23T08:25:28+00:00

Is this the right format? When i try to use it it gives me

  • 0

Is this the right format? When i try to use it it gives me a blank page with no error msg.

$type = $row['page_type'];

$art = "Article";
$vid = "Video";
$pho = "Photo";
$link = "Link";

if ( $type === $art ) {
  $page = "art.php";
} elseIF ($type === $vid) {
  $page = "vid.php";
} elseIF ($type === $pho) {
  $page = "photo.php";
} else { 
  } elseIF ($type === $link) {
    $page = "link.php";
  } else { 
    echo("Error");
  }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:25:29+00:00Added an answer on May 23, 2026 at 8:25 am

    You have an extra }else{

    if ( $type === $art ) {
          $page = "art.php";
    }elseif($type === $vid) {
          $page = "vid.php";
    }elseif($type === $pho) {
          $page = "photo.php";
    // This should not be here --> }else{ 
    }elseif($type === $link) {
          $page = "link.php";
    }else{ 
          echo("Error");
    }
    

    EDIT:

    You could also use a hash for this:

    $h = array("Article"=>"article.php", "Video"=>"vid.php", ...);
    if(array_key_exists($type, $h)){
        $page = $h[$type];
    }else{
        echo "Error";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now I have double numba = 5212.6312 String.Format({0:C}, Convert.ToInt32(numba) ) This will give
Is this right for When 4 < 5 and 1 < 2 ? <xsl:when
I'm learning this right now so the questions might be a little juvenile. Here's
Do I have this right ... // Reactor.h @property(nonatomic, retain) NSMutableArray *reactorCore; // Reactor.m
Not sure I heard this right, but VS2010 no longer has support for Wix?
I've been battling to get this right...basically I have the following HTML setup: <div
I have had a few problems getting this right, so I wanted to ask
Im not sure if I'm doing this right. I have an action that I
I never seem to get this right. I've got a method that returns a
I hope I can explain this right I have two input fields that require

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.