title: Use PHP to set a CSS ID from display: none to display: block
body: <p>I would like to use PHP to change a CSS ID from 'display: none' to 'display: block' once the page has refreshed.  </p>
  
  <p>I have tried to apply an instruction through an IF statement but it does not seem to work. </p>
  
  <p>I would be grateful for any advice and also grateful for some example code so that I can see where I am going wrong! :(</p>
  
  <pre><code>#successMsg {
      height: auto;
      background-color: #7ACF00;
      width: 50%;
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      border-radius: 20px;
      z-index: 7;
      color: white;
      padding: 30px;
      display: none;
  }
  
  
  
   &lt;div id="contactOuter"&gt;
          &lt;div id="contactInner"&gt;
              &lt;div id="contactInnerWrapper"&gt;
                  &lt;a href="#"&gt;&lt;span id="close"&gt;&amp;times;&lt;/span&gt;&lt;/a&gt;
                  &lt;h1 id="h1contactForm"&gt;Get in touch&lt;/h1&gt;
                  &lt;div id="errorDiv"&gt;&lt;/div&gt;
                  &lt;form method="post" action="index.php"&gt;
                      &lt;label for="email"&gt;Email address:&lt;/label&gt;&lt;br&gt;
                      &lt;input  type="email" name="email"  placeholder="Enter email" id="email"&gt;
                      &lt;label for="subject"&gt;Subject:&lt;/label&gt;
                      &lt;input  type="text" name="subject" id="subject"&gt;&lt;br&gt;
                      &lt;label for="body"&gt;What would you like to ask us?&lt;/label&gt;&lt;br&gt;
                      &lt;textarea  type="text" name="body" rows="7" id="content"&gt;&lt;/textarea&gt;
                      &lt;button type="submit" name="submit" id="submit"&gt;Submit&lt;/button&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
          &lt;/div&gt;
     &lt;/div&gt;
     &lt;div id="successMsg"&gt;&lt;?php echo $msg; ?&gt;&lt;/div&gt;
  
  
  &lt;?php
  
      if (sendemail('info@example.com', $email, $subject, $body)) {
          ?&gt;
              &lt;style type="text/css"&gt;#successMsg {
                  display:block;
              }&lt;/style&gt;
          &lt;?php
      } else
          $msg = 'Email failed, please try again later';
  
      }
  
  ?&gt;
  </code></pre>