html - Displaying an alert box of error message using CSS -


am creating login form on website whereby having trouble creating alert box @ top of form should display error messages after server-side validation , sanitization of user input.the problem when page loads, displays alert-box, while want display when displaying error messages. please assist?

html part

<!doctype html> <html> <head>   <title>login form</title>   <link href="style.css" rel="stylesheet" type="text/css"> </head> <body>  <div class="form">  <span class="info"> <?php         echo             $fnameerr;             $lnameerr;             $emailerr;  ?> </span>   <br>      <ul class="tab-group">         <li class="tab active"><a href="#signup">sign up</a></li>         <li class="tab"><a href="login.php">log in</a></li>     </ul>  <div class="tab-content"> <h1>sign free</h1>                   <form action="signup.php" method="post" autocomplete="off">                      <div class="top-row">                         <div class="field-wrap">                             <label>                                 <span class="req"></span>                             </label>                             <input placeholder="firstname*" type="text" value="<?php echo $firstname;?>" required autocomplete="off" name='firstname' />                         </div>                          <div class="field-wrap">                             <label>                                 <span class="req"></span>                             </label>                             <input placeholder="lastname*" type="text" value="<?php echo $lastname;?>" required autocomplete="off" name='lastname' />                         </div>                     </div>                      <div class="field-wrap">                         <label>                             <span class="req"></span>                         </label>                         <input placeholder="email address*" type="email" value="<?php echo $email;?>" required autocomplete="off" name='email' />                     </div>                      <div class="field-wrap">                         <label>                             <span class="req"></span>                         </label>                         <input placeholder="set password*" type="password"required autocomplete="off" name='password'/>                     </div>                      <button type="submit" class="button button-block" name="register">register</button>                  </form>    </div> <!-- /form -->  </div>   </body> </html> 

style.css page

.info {     color: pink;     display: block;     text-align: center;     padding: 5px;     margin-top: -20px;     margin-bottom: 15px;     border: 1px solid red;     background: #66131c; } 

<span class="info"> <?php         echo             $fnameerr;             $lnameerr;             $emailerr;  ?> </span> 

try changing below. let me know how goes

<?php if(isset($fnameerr) || isset($lnameerr) || isset($emailerr)){     echo "<span class='info'>";     echo $fnameerr . $lnameerr . $emailerr;     echo "</span>" } ?> 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -