title: How can i print modal form (popup window) with php echo function?
body: <p>Ok i have next problem. When form was submitted i have two echo functions. First echo function print popup window with text "Your message has been sent", and the other one "Error. Please fill form again." <strong>That popup window (or modal, hovever) need to be activated on that echo functions</strong>, i have code when that popup window open on form submit, but i need that popup window to be "printed" on screen in echo functions, after form was submitted. Anyone? thank you brothers.</p>
  
  <p>PHP:</p>
  
  <pre><code>// If everything is OK...
        if( !empty($name) &amp;&amp; !empty($email) &amp;&amp; !empty($message) ) {
  
            // ...send message:
            $from = "From: $name&lt;$email&gt;\r\nReturn-path: $email";
            $subject = "Message from the client.";
            mail("someone@company.gr", $subject, $message, $from);
  
                echo '
                &lt;!-- Message about success --&gt;
                &lt;script type="text/javascript"&gt;
  
                    $(document).ready(function(){msg_sent()}});
  
                &lt;/script&gt;
                &lt;!-- End --&gt;';
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;!-- HTML form --&gt;
  &lt;form action="index.php" method="post" enctype="multipart/form-data" id="form"&gt;
  &lt;input type="text" name="name" class="ime" placeholder="Unesite Vaše ime" maxlength="25"       value="&lt;?php if(isset($_POST['name'])) echo $_POST['name']; ?&gt;" /&gt;
    &lt;input type="text" name="email" class="email_a" placeholder="Unesite Vaš email" maxlength="35" value="&lt;?php
    if(isset($_POST['email'])) echo $_POST['email']; ?&gt;" /&gt;
    &lt;textarea name="message" class="poruka" placeholder="Vaša poruka..." value="&lt;?php if(isset($_POST['message'])) echo $_POST['message'] ?&gt;"&gt;&lt;/textarea&gt;
    &lt;input type="submit" name="submit" class="posalji" value="Pošalji" /&gt;
    &lt;/form&gt;
    &lt;!-- The end --&gt;
  
  &lt;div id="alertBox"&gt;
          &lt;p class="title"&gt;Congrats!&lt;/p&gt;
          &lt;p class="txt"&gt;Your message has been sent.&lt;/p&gt;
          &lt;p class="ok"&gt;OK&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>CSS:</p>
  
  <pre><code>/* Popup */
  #meni #alertBox {
      position: absolute;
      top: 200%;
      left: 50%;
      width: 400px;
      height: 200px;
      margin-left: -200px;
      margin-top: -200px;
      border: 3px solid #c5c5c5;
      border-radius: 2px;
      background-color: #fff;
      display: none;
      z-index: 100; }
  /* Kraj */
  
  /* Title */
  #alertBox .title {
   float: left;
   margin-left: 159px;
   margin-top: 9px;
   font-family: Tahoma, Helvetica, sans-serif;
   font-size: 17px;
   color: #333;
   text-align: center; }
  /* Kraj */
  
  /* Text */
  #alertBox .txt {
   float: left;
   margin-left: 117px;
   margin-top: 7px;
   font-family: Tahoma, Helvetica, sans-serif;
   font-size: 16px;
   color: #333;
   text-align: center; }
  /* Kraj */
  
  /* OK button */
  #alertBox .ok {
   float: left;
   margin-left: 161px;
   margin-top: 65px;
   font-family: Tahoma, Helvetica, sans-serif;
   font-size: 16px;
   color: #fff;
   background-color: #00ccff;
   padding: 4px 13px;
   border: none;
   border-radius: 2px;
   cursor: pointer;
   opacity: 1.0;
   filter: alpha(opacity="100"); }
  /* Kraj */
  
  /* OK button (hover effect) */
  #alertBox .ok:hover {
   opacity: 0.8;
   filter: alpha(opacity="80"); }
  </code></pre>
  
  <p>JScript:</p>
  
  <pre><code>$(document).ready(function()
  {
        $('#form').submit(function(e)
         {
             e.preventDefault();
              msg_sent();
          });
      $('.ok').click(function()
        {
                            $('#alertBox').fadeOut()
         });
   });
  function msg_sent()
  {
      $('#alertBox').fadeIn();
  }
  </code></pre>