Hello all,

I have a problem with geting the div content which was populated from a php/mysql script.
please i need help. in the modal. the only echo i get is the last variable passed, regardless of the which ever dif i click.

<?php
require_once 'connect.php';

    if(isset($_GET['userID'])){
        require_once 'dbconfig.php';

        $query = dbConnect()->prepare("SELECT * FROM storePoints WHERE userID=:userID");
        $query->bindParam(':userID', $_GET['userID']);
        $query->execute();
        $query->setFetchMode(PDO::FETCH_ASSOC);
    }
?>



<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">

    <title>My Stores</title>

    <!-- Bootstrap core CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="jumbotron.css" rel="stylesheet">

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->

      <style>
    body {
  padding-top: 0px;
  padding-bottom: 50px;
    }
    .jumbotron {
        padding-top: 5px;
        padding-bottom: 0px;
        margin-bottom: 10px;
    }
    .jumbotron p {
        margin-bottom: 5px
    }
    .jumbotron h1 {
        margin-top: 0px
    }
  </style>

  </head>
  <body>

    <!-- Main jumbotron for a primary marketing message or call to action -->
    <?php while ($r = $query->fetch()): ?>
        <div class="jumbotron">
          <div class="container">
            <h1><?php $store = htmlspecialchars($r['storeName']); echo $store;?></h1>
            <p class="lead">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
            <p><a class="btn btn-lg btn-success" href="#myModal" data-toggle="modal" role="button"><?php $point = htmlspecialchars($r['points']); echo $point; ?></a></p>
          </div>
        </div>
    <?php endwhile; ?>


        <!-- Modal HTML -->
    <div id="myModal" class="modal fade">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title">Confirmation</h4>
                </div>
                <div class="modal-body">

                    <?php echo $store;?>
                    <?php echo $store;?>

                </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>

      <footer>
        <p>&copy; ezy 2015</p>
      </footer>
    </div> <!-- /container -->


    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script src="../../dist/js/bootstrap.min.js"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>
  </body>
</html>

Your problem has nothing to do with modal windows (that I don't see anywhere in your code). Client side you have js , css and html (served by server side), and server side you have PHP.

Have you created a modal window and that one doesn't work ?

Create an empty + hello world , modal window client side , make it work and then trouble about PHP.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.