if($ _ GET ['info'] == ...)不检查[关闭]

I wrote a little check to display succes messages whenever a form is validated succesfully. However the check I use doesn't work. it doesn't matter what $_GET['info'] is, it just shows all messages unless $_GET['info] is empty. so even when info = loggin it shows all three messages. any help?

                if(!empty($_GET['info'])){
                    if($_GET['info'] == "succes-paid");{
                        echo "<p class='succes'>De bestelling/inschrijving is succesvol verlopen.</p>";
                    }
                    if($_GET['info'] == "succes-register");{
                        echo "<p class='succes'>U werd succesvol geregistreerd.</p>";
                    }
                    if($_GET['info'] == "login");{
                        echo "<p class='succes'>U werd succesvol ingelogd.</p>";
                    }
                }

You have a semi-colon after each of your if statements. The semi-colon means "finish the statement". Therefore your program thinks that you are done with the if and everything in your braces is treated as a block separate from your if statement. That is why those blocks are always executing.

It's because of the semicolon right after the condition of the if.

That line is actually two statements. The first is the if with condition, followed by an 'empty' statement, ended by a semi-colon. The second is a compound statement (a block of statements within a set of { .. }. The compound statement doesn't have a condition at all, so it is always executed.

 if($_GET['info'] == "succes-paid")  ; {echo 'x'}
 condition with no statement  -----^ ^ ^--------^-- compound statement without condition 
                                     \_The semi-colon that separates them. 

And you have this situation three times, hence three lines of output.