samedi 27 juin 2015

If Statement and Session

I have a form that is posting sessions back to my index page. Based on those sessions I am using echo to load a modal window from the results. I keep getting a 500 error. I can't figure out why.

<?

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>";

}

?>

Aucun commentaire:

Enregistrer un commentaire