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 8791813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:53:40+00:00 2026-06-13T22:53:40+00:00

I have been designing a shopping website lately in PHP. Now in Checkout page

  • 0

I have been designing a shopping website lately in PHP. Now in Checkout page i have to check many times if the user is logged in. i.e If the user is logged in hide the Signin div and show the Shipping div.

<section class="panels <?php if(!isset($_SESSION['username'])) echo"unactivepanel"; else echo"activepanel";?>" id="Sign In">
        <div class="wrapper1" >
            <ul>
            <li><input type="email" placeholder="Enter your email address" required/></li>
            <li class="inf">(will only be used for sending you order information.)</li>
            <fieldset><legend class="orb"> OR</legend>
            <li><input type="button" value="Sign In to booksmore" class="sb si llb" /></li></fieldset>
            <fieldset><legend class="orb"> OR</legend>
            <li>Sign In using any of following service:</li>
            <li>
                <div class="box1 fc">Facebook</div>
                <div class="box1 tw">Twitter</div>
                <div class="box1 gg">Google</div>
                <div class="box1 oi">Open Id</div>
            </li></fieldset>

            </ul>
        </div>
    </section>
    <section class="panels <?php if(!isset($_SESSION['username'])) echo"unactivepanel"; else echo"activepanel";?>unactivepanel" id="Shipping"></section>
    <section class="panels unactivepanel" id="Confirm"></section>

What i have studied is using too many if block slows down the executions speed, So am I right using too many if blocks ? if I am not coding it right(what i feel right now) then what may be the possible alternatives to if blocks ? (I was thinking of using switch block.)

  • 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-06-13T22:53:40+00:00Added an answer on June 13, 2026 at 10:53 pm

    If you are using same if else at every place you can easily refactor like.

    <?php 
    if(!isset($_SESSION['username'])) 
     $class = "unactivepanel"; 
    else 
     $class = "activepanel";
    ?>
    

    now simply do echo $class wherever you need it,like

     <section class="panels <?php echo $class;?>unactivepanel" id="Shipping"></section>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been designing many applications for my company lately where fancy interfaces have
Lately I have been designing and coding a website for one of my clients.
So I have been working with javascript for a website I am designing, shocker
For the last few days I have been designing a layout for my website
I have been designing a site locally in PHP 5, but have come across
I have been a python programmer 7+ years now, and been designing with PyQt
I have been designing websites for a while now, but there is one thing
I have been designing my app to store local user data which is changed
I'm designing a mobile version of my website. I have been looking at Amazon
I have been working on a SQL Server database designing since long now and

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.