Jump to content

Modal button including php page


Noximity

Recommended Posts

Hello guys I'm wondering if I can make the "host.php" page appear within a modal on the same page. When a user clicks "Host a lobby' the host.php page will pop up on the same page. If anyone knows how to do this please help me! Thanks

          <?php






          if(isset($_SESSION['steamid']))
          {
            echo'
              <a href="host.php" target="_BLANK">
              <button type="button" class="btn btn-lg btn-inverse btn-custom waves-effect waves-light">Host a lobby</button>
              </a>
            ';
          }
          else
          {
            echo'
              <a href="?login">
              <button type="button" class="btn btn-lg btn-inverse btn-custom waves-effect waves-light">Log In before Hosting</button>
              </a>
            ';
          }


          ?>
Link to comment
Share on other sites

Since you are using bootstrap, You can easily create very smart and flexible dialog boxes with the Bootstrap modal plugin.

 

Try this,

if(isset($_SESSION['steamid'])){
  echo '<button type="button" class="btn btn-lg btn-inverse btn-custom waves-effect waves-light" data-toggle="modal" data-target="#myModal">
          Host a lobby
        </button>';
}

Don't use <a> tag with button.

 

Modal HTML:

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        ... modal contents here ....
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>
Edited by thara
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.