"如果"声明和会议

时间:2015-06-27 18:30:28

标签: php if-statement

我有一个表单将会话发布回我的索引页面。根据这些会话,我使用echo从结果中加载模态窗口。我一直收到500错误。我无法弄清楚原因。

if($_SESSION["submitemail"] == "fail"){

    echo
        "<script type='text/javascript'>
            $(window).load(function(){
                $('#betaalert').modal('show');
            });
        </script>


        <div class='modal fade' role='dialog' id='formerror'>
          <div class='modal-dialog'>

            <!-- Modal content-->
            <div class='modal-content'>
              <div class='modal-header'>
                <button type='button' class='close' data-dismiss='modal'>&times;</button>
                <h4 class='modal-title'>Could not send message...</h4>
              </div>
              <div class='modal-body'>
                <?
                echo '<p>We are very sorry, but there were error(s) found with the form you submitted.</p>';
                echo '<p>These errors appear below.</p><br /><br />';
                echo $_SESSION['errormessage'].'<br /><br />';
                echo '<p>Please go back and fix these errors.</p><br /><br />';
                ?>
              </div>
              <div class='modal-footer'>
                <a href='#' class='btn btn-primary' data-dismiss='modal'>Close</a>
              </div>
            </div>

          </div>
        </div>";

}

else if($_SESSION["submitemail"] == "success"){

    echo
        "<script type='text/javascript'>
            $(window).load(function(){
                $('#betaalert').modal('show');
            });
        </script>

        <!-- Modal -->
        <div class='modal fade' role='dialog' id='formsent'>
          <div class='modal-dialog'>

            <!-- Modal content-->
            <div class='modal-content'>
              <div class='modal-header'>
                <button type='button' class='close' data-dismiss='modal'>&times;</button>
                <h4 class='modal-title'>Thank You <? echo $_POST['first_name']; ?> <? echo $_POST['last_name']; ?>!</h4>
              </div>
              <div class='modal-body'>
                <?
                echo '<p>We appreciate your business and will be contacting you as soon as possible. Please allow 48 hours for us to process your request before sending another. Thank you!/p>';
                ?>
              </div>
              <div class='modal-footer'>
                <a href='#' class='btn btn-primary' data-dismiss='modal'>Close</a>
              </div>
            </div>

          </div>
        </div>";

}

else {

    echo
        "<script type='text/javascript'>
            $(window).load(function(){
                $('#betaalert').modal('show');
            });
        </script>

        <!-- Modal -->
        <div class='modal fade' role='dialog' id='betaalert'>
          <div class='modal-dialog'>

            <!-- Modal content-->
            <div class='modal-content'>
              <div class='modal-header'>
                <button type='button' class='close' data-dismiss='modal'>&times;</button>
                <h4 class='modal-title'>ANNOUNCEMENT!</h4>
              </div>
              <div class='modal-body'>
                <p>However we are pleased to announce that our beta testing program is open to all ambulance companies interested. If you are interested use the contact form on the bottom of this page to send us a message with your contact information and we will get you started with testing ASAP!</p>
              </div>
              <div class='modal-footer'>
                <a href='#' class='btn btn-primary' data-dismiss='modal'>Close</a>
              </div>
            </div>

          </div>
        </div>";

}

1 个答案:

答案 0 :(得分:0)

没关系,我明白了!谢谢你,为了将来,我会确保发布更多信息。