从while循环

时间:2016-03-26 00:25:11

标签: php html twitter-bootstrap

我不太清楚如何做到这一点。在我的while循环中,打印出五个更改链接。我有一个模块弹出框,当用户按下更改时我需要调用它。如何从"更改"中调用我的模态框?在我的while循环中?

$stmt->bind_result($firstname, $lastname, $username, $email, $password);
  while($stmt->fetch()) {
    echo  "<tr><td>Firstname</td><td>".$firstname."</td><td><h5><a href='#'>Change</a></h5></td></tr>".
          "<tr><td>Lastname</td><td>".$lastname."</td><td><h5><a href='#'>Change</a></h5></td></tr>".
          "<tr><td>Username</td><td>".$username."</td><td><h5><a href='#'>Change</a></h5></td></tr>".
          "<tr><td>Email</td><td>".$email."</td><td><h5><a href='#'>Change</a></h5></td></tr>".
          "<tr><td>Password</td><td>".$password."</td><td><h5><a href='#'>Change</a></h5></td></tr>";
  }

弹出模式:

<?php
if( !isset( $_SESSION ) ) session_start();
?>
<?php include dirname(dirname(__DIR__)).'/resources/includes/header.html'; ?>
<?php include dirname(dirname(__DIR__)).'/resources/dbconnect/dbconfig.inc.php'; ?>

    <!--container start-->
    <div class="component-bg">
      <div class="container">
        <div class="bs-docs-section">
          <h2 id="tables-hover-rows">
            Profile Settings
          </h2>
          <p>
            Change your profile settings here.
          </p>
          <div class="bs-example">
            <table class="table table-hover">
              <thead>
                <tr>
                  <th>
                    #
                  </th>
                  <th>
                    Information
                  </th>
                  <th>

                  </th>
                  <th>
                    <div class="container">

  <!-- Trigger the modal with a button -->
  <button type="button" class="btn btn-info btn-xs" data-toggle="modal" data-target="#myModal">Open Modal</button>

  <!-- Modal -->
  <div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">

      <!-- Modal content-->
      <div class="form-wrapper-change-userinformation">

        <div class="form-wrapper-change-userinformation">

            <!-- Modal -->

          <div class="form-wrapper-change-userinformation">
              <form class="form-signin wow fadeInUp" method="post" action="">
                <h2 class="form-signin-heading">Update</h2>
                <div class="login-wrap">
                  <hr>
                      <p>Username</p>
                        <input id="disabledInput" type="text" disabled class="form-control" name="username" placeholder="User ID" 

                        value="<?php
                          $stmt = $mysqli->prepare("SELECT username FROM login WHERE username ='$_SESSION[username]'");

                          $stmt->execute();

                          $username = null;

                          $stmt->bind_result($username);
                              while($stmt->fetch()) {
                                echo  $username;
                          }
                          ?>">

                    <hr>
                      <input type="text" class="form-control" name="username" placeholder="New Username" autofocus>
                    </hr>
                    </label>
                    <button class="btn btn-lg btn-login btn-block">Update<a href="index.php?todo=logout">Update</a></button>
                </div>
              </form>
            </div>

        <!-- End Modal Container -->                
      </div>
      <!-- End Modal Content -->
    </div>
    <!-- End Modal Content -->
  </div>
  <!-- End Modal-dialog -->
</div>
<!-- End Container -->
                  </th>
                </tr>
              </thead>
              <tbody>

0 个答案:

没有答案