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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:11:41+00:00 2026-06-07T09:11:41+00:00

I have a website where i need to use a while statement, but when

  • 0

I have a website where i need to use a while statement, but when i use it, it repeats the echo infinitely. Although it looks like i could make it work without while, that isnt so, this is a simplified version of a final product that will need while.

<?php 
$passlevel = '0';
while ($passlevel == '0')
{
    if(isset($_GET['box_1_color']))
    {
        $color=$_GET['box_1_color'];
        if($color == "#800080")
        {
            echo "you have passed step one.";
            $passlevel == '1';      
        }
        else 
        {
            echo "you didn't select purple.";
        }   
    }
    else echo "contact webmaster";
}
?>

Why is it echoing either contact webmaster or you didnt select purple an infinite number of times?

  • 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-07T09:11:42+00:00Added an answer on June 7, 2026 at 9:11 am

    First, you probably need to change:

    $passlevel == '1';
    

    to

    $passlevel = '1';
    

    The first is a comparison equals, not an assignment equals.

    Second, if $color is not #800080, then the loop does not terminate and thus repeats forever as nothing in the loop causes the value to change.

    I’m not entirely sure of the point of this loop in the first place. It should work perfectly fine without the loop, however you’ve stated that your code is a simplified version of something more complicated that indeed needs a loop. Perhaps you can elaborate.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a website which I need to update, but I've lost the local
I have a website I need to find the id of my selected profile
I have a website and I need to send personalized emails to registered members.
I have a website for which I need to implement the admin interface. The
I have a website based on Wordpress, built with pages. I need to have:
I have a website with a menu. To generate the menu, I need some
I have a cart on my website and I need to let users easily
I have a rendered Highcharts chart on a website and I need to empty
I have a simple website. Now I need to measure traffic to my website.
I have one custom website with code created 100% by me. I need to

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.