Вопрос

I am crating a registration form. When the user clicks the register button, if there is any errors I need to show them.For that I wrote the following code,

<?php  if($flag==0)
       {
   ?>
         <div class="info-message">
                <?php echo $error_message;?>
         </div><?php 
      }

the css is,

    .info-message{
     background:yellow;
     padding:10px;
     border:1px solid black;
     color:black;
     width:780px;
}

but if the value of $flag = 1, padding space of the div is visible, but I needn't show the div if the value of $flag != 0. Please help me to solve this.

Это было полезно?

Решение

The div.info-message will only appear if $flag == 0. If you don´t want to show an empty div with padding you have to check also if $error_message == false! If that is not helpful I don´t understand your question!

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top