Jump to content

how to move error handlers


piano0011

Recommended Posts

I would like to have some error handlers on my page so that when the user click on certain links and not login, it will be displayed on the page. I am trying to follow the format of having php at the top and html at the bottom but when adding the following error handlers, I found that it needs to go at the bottom of the page for the whole html contents to be shown: 

This is my CSS code for it:

div.error {
  color: red;
  position: relative;
  bottom: 900px;
  left: 500px;
}
 <!DOCTYPE html>
   <html>
   <head>
     <title>PianoCourse101</title>
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <link rel="stylesheet" type="text/css" href="style.css">
      <link href="https://fonts.googleapis.com/css?family=Aldrich|Mr+Dafoe" rel="stylesheet">
   <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
     <link href="https://fonts.googleapis.com/css?family=Pacifico" rel="stylesheet">
     
   </head>
   <body>
   
   </body>
   </html>   

<section class="main-container">

     <img class="pc101" src="includes/pictures/pc101.gif" alt="pianocourse101 logo"/>
    <div class="music"><i class="fas fa-music fa-8x"></i></div>

    <div class="sharp"><p>&#9839</p></div>
    <div class="natural"><p>&#9838</p></div>
    <div class="flat"><p>&#9837</p></div>
    

    <div class="main-wrapper">
      <div class="title">
       <h3>Welcome to PianoCourse101</h3>
     </div>
       <br></br>
    </div>

    <div class="main-wrapper">
      <div class="first">
       <h1>At PianoCourse101, your child can now learn how to play Classical music right from the comfort of your own home!<br></br>PianoCourse101 teaching methods are based on the Bastie Piano Basics series and therefore, we highly recommend you to purchase the book prior to your piano lessons!<br></br> At PianoCourse101, you can choose 4 levels beginning with the FREE "Bastien Piano Basics: Primer Level" lessons!<br></br>If you would like a challenge and are ready to progress to the next level, then you can choose to upgrade your free membership to premium membership, where you can access Level 1, Level 2 and Level 3!<br></br>Also, please ensure that you have read the Q/A section of the website and if you have any questions, you can email to our customer support team from the Contact Us section. </h1>
     </div>
    </div>
    
    <div class="form">
    <form class="signup-form" action="newsletters.php" method="POST">
       <label><center>Enter your E-mail Address</center></label>
       <br></br>
       <center><input type="text" name='email' placeholder="Enter E-mail Address"></center>
       <br></br>
       <center><button type="submit" name="submit">Subscribe to PianoCourse101!</button></center>
       <br></br>

    </form>
    </div>


    <img class="snoopy" src="includes/pictures/snoopy.jpg"  alt="snoopy playing the piano" />

   </section>

   



          
</body>
</html>

      





<?php
include_once 'footer.php';


$fullUrl = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";

         // Primer level error handlers
         
         if (strpos($fullUrl, "primer=notchosen") == true) {
               echo "<br>";
               echo "<div class='error'>You have not subscribed for Primer Level Lessons!</div";
               exit();
         }

         if (strpos($fullUrl, "primer=maintenance") == true) {
               echo "<br>";
               echo "<div class='error'>Your Primer Level Lessons are under maintenance</div>";
               exit();
         }

         if (strpos($fullUrl, "primer=notlogin") == true) {
               echo "<br>";
               echo "<div class='error'>You have not login!</div>";
               exit();
         }

It is displayed in the middle of the page but doesn't seem to move when I add some positioning..

image.thumb.png.5e92e8d2eae52f31f920caa12754221c.png

 

Link to comment
Share on other sites

Apologies.... It is moving in IE browser but not in Chrome but for some reasons.. For some reason, IE is more reliable on my computer...

Also, according to my IE browser, it doesn't seem to show my pictures at the top of the page whereas in Chrome, it does. This is very confusing but looking at my html page, I forgot to add those pictures in. However, once added, now it looks like I have duplicated the pictures....I should have the three pictures above my pc101 logo...

<!DOCTYPE html>
   <html>
   <head>
     <title>PianoCourse101</title>
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <link rel="stylesheet" type="text/css" href="style.css">
      <link href="https://fonts.googleapis.com/css?family=Aldrich|Mr+Dafoe" rel="stylesheet">
   <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
     <link href="https://fonts.googleapis.com/css?family=Pacifico" rel="stylesheet">
     
   </head>
   <body>
   
   </body>
   </html>   

<section class="main-container">

     <div class="crotchet">
<p>&#x1D15F</p>
</div>
<div class="minim">
<p>&#x1D15E</p>
</div>
<div class="quaver">
<p>&#x1D160</p>
</div>

     <img class="pc101" src="includes/pictures/pc101.gif" alt="pianocourse101 logo"/>
    <div class="music"><i class="fas fa-music fa-8x"></i></div>

    <div class="sharp"><p>&#9839</p></div>
    <div class="natural"><p>&#9838</p></div>
    <div class="flat"><p>&#9837</p></div>
    

    <div class="main-wrapper">
      <div class="title">
       <h3>Welcome to PianoCourse101</h3>
     </div>
       <br></br>
    </div>

    <div class="main-wrapper">
      <div class="first">
       <h1>At PianoCourse101, your child can now learn how to play Classical music right from the comfort of your own home!<br></br>PianoCourse101 teaching methods are based on the Bastie Piano Basics series and therefore, we highly recommend you to purchase the book prior to your piano lessons!<br></br> At PianoCourse101, you can choose 4 levels beginning with the FREE "Bastien Piano Basics: Primer Level" lessons!<br></br>If you would like a challenge and are ready to progress to the next level, then you can choose to upgrade your free membership to premium membership, where you can access Level 1, Level 2 and Level 3!<br></br>Also, please ensure that you have read the Q/A section of the website and if you have any questions, you can email to our customer support team from the Contact Us section. </h1>
     </div>
    </div>
    
    <div class="form">
    <form class="signup-form" action="newsletters.php" method="POST">
       <label><center>Enter your E-mail Address</center></label>
       <br></br>
       <center><input type="text" name='email' placeholder="Enter E-mail Address"></center>
       <br></br>
       <center><button type="submit" name="submit">Subscribe to PianoCourse101!</button></center>
       <br></br>

    </form>
    </div>


    <img class="snoopy" src="includes/pictures/snoopy.jpg"  alt="snoopy playing the piano" />

   </section>

   

image.png.290bae3b2f00234f6064659784000158.png

image.thumb.png.81354c2a807aa0d5b50cf3c0e5f7348c.png

Link to comment
Share on other sites

This is weird and chrome is showing the pictures well but I don't have that in my html code! When I include inside the code, chrome is displaying each twice! I am still wondering why my error handlers won't be displayed when I use p class?

$fullUrl = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";

         // Primer level error handlers
         
         if (strpos($fullUrl, "primer=notchosen") == true) {
               echo "<br>";
echo "<p class='error'>You have not subscribed for Primer Level Lessons!</p>";
               exit();
         }

and in my CSS... if I do this... .p.error {}, it won't work... My apologies, I think my codes was wrong... should be just .error {}, then it will work...

image.thumb.png.d7bad680b4e1a33628360373530c96ab.png

 


 
Link to comment
Share on other sites

This is strange though because this is my html code and I only have 3 pictures above my pc101 logo:

 <!DOCTYPE html>
   <html>
   <head>
     <title>PianoCourse101</title>
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <link rel="stylesheet" type="text/css" href="style.css">
      <link href="https://fonts.googleapis.com/css?family=Aldrich|Mr+Dafoe" rel="stylesheet">
   <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
     <link href="https://fonts.googleapis.com/css?family=Pacifico" rel="stylesheet">
     
   </head>
   <body>
   
   </body>
   </html>   

<section class="main-container">

     <div class="crotchet">
<p>&#x1D15F</p>
</div>
<div class="minim">
<p>&#x1D15E</p>
</div>
<div class="quaver">
<p>&#x1D160</p>
</div>

     <img class="pc101" src="includes/pictures/pc101.gif" alt="pianocourse101 logo"/>
    <div class="music"><i class="fas fa-music fa-8x"></i></div>

    <div class="sharp"><p>&#9839</p></div>
    <div class="natural"><p>&#9838</p></div>
    <div class="flat"><p>&#9837</p></div>
    

    <div class="main-wrapper">
      <div class="title">
       <h3>Welcome to PianoCourse101</h3>
     </div>
       <br></br>
    </div>

    <div class="main-wrapper">
      <div class="first">
       <h1>At PianoCourse101, your child can now learn how to play Classical music right from the comfort of your own home!<br></br>PianoCourse101 teaching methods are based on the Bastie Piano Basics series and therefore, we highly recommend you to purchase the book prior to your piano lessons!<br></br> At PianoCourse101, you can choose 4 levels beginning with the FREE "Bastien Piano Basics: Primer Level" lessons!<br></br>If you would like a challenge and are ready to progress to the next level, then you can choose to upgrade your free membership to premium membership, where you can access Level 1, Level 2 and Level 3!<br></br>Also, please ensure that you have read the Q/A section of the website and if you have any questions, you can email to our customer support team from the Contact Us section. </h1>
     </div>
    </div>
    
    <div class="form">
    <form class="signup-form" action="newsletters.php" method="POST">
       <label><center>Enter your E-mail Address</center></label>
       <br></br>
       <center><input type="text" name='email' placeholder="Enter E-mail Address"></center>
       <br></br>
       <center><button type="submit" name="submit">Subscribe to PianoCourse101!</button></center>
       <br></br>

    </form>
    </div>


    <img class="snoopy" src="includes/pictures/snoopy.jpg"  alt="snoopy playing the piano" />

   </section>

   <div class="services_main">Services</div>
      <div class="services">
         <div class="service1">
            <h1>Level 1</h1>
            <div class="piano">
            <a href="update.php"><p>&#127929</p></a>
            </div>
            <p>Purchase the Level 1 Subscriptionplan!<br>Learn how to play the piano right from the comfort of your own home!<br>Monthly fee: $100<br>Yearly fee: $800</p>
            <div class="service2">
            <h1>Level 2</h1>
            <div class="piano">
            <a href="update.php"><p>&#127931</p></a>
            </div>
            <p>Purchase the Level 2 Subscriptionplan!<br>Learn how to play the piano right from the comfort of your own home!<br>Monthly fee: $150<br>Yearly fee: $1300</p>
          </div>
          <div class="service3">
            <h1>Level 3</h1>
            <div class="piano">
            <a href="update.php"><p>&#127929</p></a>
            </div>
            <p>Purchase the Level 3 Subscriptionplan!<br>Learn how to play the piano right from the comfort of your own home!<br>Monthly fee: $200<br>Yearly fee: $1800</p>
         </div>
      </div>





          
</body>
</html>

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.