Problems with 2/7


#1

What is the problem?

The error:
Oops, try again. expected p:first-child text to be equal to The loop is running. but got And now it's done.

The code:

<!DOCTYPE html>
<html>
    <head>
		<title>Your First PHP while loop!</title>
	</head>
	<body>
    <?php
	$loopCond = true;
	while ($loopCond == true){
		//Echo your message that the loop is running below
		echo "The loop is running.";
		$loopCond = false;
	}
	echo "<p>And now it's done.</p>";
    ?>
    </body>
</html>

#2

Instructions
02.

Inside the curly braces, use echo to output
<p>The loop is running.</p>"

I didnt can see the <p></p> in your code.

By the way it is enough to type

while($loopCond) // If $loopCond is true, the loop begins

#3

<?php
$loopCond = true;
while ($loopCond == true){
//Echo your message that the loop is running below
echo "

The loop is running.

";
$loopCond = false;
}
echo "

And now it's done.

";
?>

got error: Oops, try again. It seems you have not filled in the loop condition correctly


#5

I had my problems with this lesson aswell, so I post the correct code below for ppl, which might face the issue.

      <?php
        $loopCond = true;
        while ($loopCond){
          //Echo your message that the loop is running below
          echo "<p>The loop is running.</p>";
          $loopCond = false;
        }
        echo "<p>And now it's done.<p>";       
     ?>

#6

this is not the correct code at all you get an undefined loop condition on line 9 with this code


#7

Same here

With this code:







<?php

$loopCond = true;

    while ($loopCond == true){
	    //Echo your message that the loop is running below
	    echo "<p>The loop is running.<|p>";	
	    $loopCond = false;
}
echo "<p>And now it's done.</p>";
?>
</body>

I get:
Undefined variable: LoopCond (line 9)
And now it's done.


#8

Whoops. I made a mistake. The following code works:







<?php

$loopCond = true;

    while ($loopCond == true){
	    //Echo your message that the loop is running below
	    echo "<p>The loop is running.</p>";	
	    $loopCond = false;
}
echo "<p>And now it's done.</p>";
?>
</body>


#9

its not working with this code.


#10

Ah - I was trying to create my own while loop. Made it harder than it needed to be.


#12

Get rid of the above line in your editor and it should work.


#13

it's not working





<?php
$loopCond = true;
while ($loopCond == true){
//Echo your message that the loop is running below
echo "

The loop is running.

";

}
echo "

And now it's done.

";
?>


#14

please format your code so that we ca read it


#15

the working code

    <!DOCTYPE html>
    <html>
        <head>
            <title>Your First PHP while loop!</title>
        </head>
        <body>
        <?php
        $loopCond = true;
        while ($loopCond){
            //Echo your message that the loop is running below
        echo "<p>The loop is running.</p>";
        
        
            $loopCond = false;
        }    
        
        
        echo "<p>And now it's done.</p>";
        ?>
        </body>
    </html>

#16

yes its working. thanks a lot