Skip to content
Advertisement

php error message affecting height of textboxes

I’m using php to display an error message to the user. The code is sitting at the top of the page and once the error message displays, it affects the height of my textboxes. I coded the height in a style sheet. Also, my error message is sitting inside of a div. I tried using the span tag but that isn’t working either since its still sitting at the top line of the page. This is the error message in php:

if($result != "")
{
        echo "<div id='Error'>"; 
        echo "<b>The following errors occured:</b><br>";
        echo $result;
        echo "</div>";
}

Registration div css:

#RegBody
{
    background-color: white;
    background-image: url(LilyPads.jpg);
    height: 82.7vh;
}

#RegContents
{
    position: absolute;
    margin: 39px auto 0 402px;
    border-radius: 20px;
    background-color: white;
    width: 500px;
    height: 455px;
    padding-left: 57px;
}

#RegisterUser
{
    font-family: Arial, Helvetica, sans-serif;
    font-weight: bold;
    font-size: 15px;
    margin-top: 14px;
    margin-left: 112px;
    color: #1A3D5B;
    width: 215px;
    height: 30px;
    color: white;
    background-color: #1A3D5B;
    border-color: #1A3D5B;
    border-style: solid;
    border-radius: 20px;
}

Error message css:

#Error
{
    position: absolute;
    background-color: white;
    border: 2px solid red;
    border-radius: 20px;
    width: 200px;
    padding: 15px;
    margin: 147px 0 0 70px;
    color: red;
}

Here’s the css for the textboxes:

input[type='text']
{
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    text-indent: 10px;
    width: 210px;
    height: 25px;
    border-color: #1A3D5B;
    border-style: solid;
    border-radius: 20px;
}

Before the error message:

Before error message

I was thinking that maybe its the font size that’s the issue but regardless…a white line also appears at the bottom of the page:

Error

Please have patience with me. I’m a student and new to php. Thank you

Advertisement

Answer

i can tell you how to rectify the error (though i am still looking for the reason because of which it happens). what i did is that i inserted the php code inside body tag and it work fine no change in Textbox dimensions.Below is the code i wrote to prove the same

    <?php 
$result=1;
 echo "<div id='Error'>"; 
        echo "<b>The following errors occured:</b><span>";
        echo $result;
        echo "</span></div>";
 ?>
 <!DOCTYPE html>
 <html>
 <head>
    <title></title>
    <style type="text/css">
    

         input[type='text']
   {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    text-indent: 10px;
    width: 210px;
    height:25px;
   
    border-color: #1A3D5B;
    border-style: solid;
    border-radius: 20px;
   }
    </style>
 </head>
 <body>

<input type='text' name=''>
    
 
</body>
 </html>

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement